Choose Language Hide Translation Bar
Highlighted
Theresa
Level III

How to new a column fill information by compare other column value

How to use script realize below function, thanks very much.

 

dt = Open( "$SAMPLE_DATA/BIG CLASS.JMP" );

 

If the value of height <=weight, then new a column name with"Status" fill "Yes" in column;

If the value of height > weight, then fill in "N" in column"Status" .

2 REPLIES 2
Highlighted

Re: How to new a column fill information by compare other column value

Here is one way to do it.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << New Column( "status", "Character", "Nominal" );

:status << Set Values(
	{ "yes", "no" }[(:height << Get As Matrix) <= (:weight << Get As Matrix)]
);
Learn it once, use it forever!
Highlighted
Theresa
Level III

Re: How to new a column fill information by compare other column value

is there any requirements on height or weight?or as long as it is a number it should be work. I try it can realize successful, but when i try in my script and change column name, it do not work any more.

The only difference is one of the column is calculation result. I can't attach pic here i will reopen a discuss

Article Labels

    There are no labels assigned to this post.