Subscribe Bookmark RSS Feed

Set Values for cells where number of cells is unknown.

robot

Community Trekker

Joined:

Feb 27, 2012

Hi,

What is the easiest way to set values for cells, where the number of cells is unknown.  For example, in the following script, it is possible to set all cells where :age==12 to :age==0, and the number of cells where :age==12 is unknown?

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

dt << Select Where( :age == 12 );

:age << Set Selected;

Column( "age" ) << Set Values( {0} );

1 ACCEPTED SOLUTION

Accepted Solutions
ms

Super User

Joined:

Jun 23, 2011

Solution

This is one way to do it

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

dt << Select Where( :age == 12 );

:age[dt << Get Selected Rows] = 0;


//Or even simpler

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

:age[dt << get rows Where( :age == 12 )] = 0;



2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

Solution

This is one way to do it

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

dt << Select Where( :age == 12 );

:age[dt << Get Selected Rows] = 0;


//Or even simpler

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

:age[dt << get rows Where( :age == 12 )] = 0;



robot

Community Trekker

Joined:

Feb 27, 2012

Perfect.  Thanks!