cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
cxu04
Level I

Data Preview in Column Formula correct, but values not appearing in Column

Hello,

 

I've created a set of columns with a for loop with the below script

For(i=1, i<= N Items(abs_cols), i++,
Eval(
	Substitute(
		Expr(
			New Column(__name2__,
				Formula(
					If(__zscore__ < 2, __abs__)
				)
			)
		),
	Expr(__name2__), "Outliers Removed " || char(abs_cols[i]),
	Expr(__zscore__), Column("Z-score " || char(abs_cols[i])),
	Expr(__abs__), Column(char(abs_cols[i]))
	)
)
);

When I run this script, the columns are created with the correct formulas, but no values are filled in any of the new columns. More puzzling is that the Data Preview shows exactly the values as I want them to be filled.

cxu04_0-1628630543644.png

I'm not sure what's going on, please help?

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Data Preview in Column Formula correct, but values not appearing in Column

It has to do the function Column() not playing well with column formulas, at last in my experience.  Instead you might try `As Column`, like this:

 

Names default to here(1);

dt = Open("$Sample_data/iris.jmp");
New Column("Z-scoreSepal length", Numeric, "Continuous", Format("Best", 12), Formula(Random Normal()));
New Column("Z-scoreSepal width", Numeric, "Continuous", Format("Best", 12), Formula(Random Normal()));

abs_cols = {:Sepal length, :Sepal width};

For(i=1, i<= N Items(abs_cols), i++,
	Eval(
		Substitute(
			Expr(
				New Column(__name2__,
					Formula(
						If(As Column(__zscore__) < 2, As Column(__abs__))
					)
				)
			),
			Expr(__name2__), char(abs_cols[i]),
			Expr(__zscore__), "Z-score " || char(abs_cols[i]),
			Expr(__abs__), char(abs_cols[i])
		)
	)
);

View solution in original post

2 REPLIES 2
ih
Super User (Alumni) ih
Super User (Alumni)

Re: Data Preview in Column Formula correct, but values not appearing in Column

It has to do the function Column() not playing well with column formulas, at last in my experience.  Instead you might try `As Column`, like this:

 

Names default to here(1);

dt = Open("$Sample_data/iris.jmp");
New Column("Z-scoreSepal length", Numeric, "Continuous", Format("Best", 12), Formula(Random Normal()));
New Column("Z-scoreSepal width", Numeric, "Continuous", Format("Best", 12), Formula(Random Normal()));

abs_cols = {:Sepal length, :Sepal width};

For(i=1, i<= N Items(abs_cols), i++,
	Eval(
		Substitute(
			Expr(
				New Column(__name2__,
					Formula(
						If(As Column(__zscore__) < 2, As Column(__abs__))
					)
				)
			),
			Expr(__name2__), char(abs_cols[i]),
			Expr(__zscore__), "Z-score " || char(abs_cols[i]),
			Expr(__abs__), char(abs_cols[i])
		)
	)
);
cxu04
Level I

Re: Data Preview in Column Formula correct, but values not appearing in Column

you're right, that worked! thanks so much!

Recommended Articles