Hi all,
I would like to get a JMP Script that allows me to extract the value that i highlighted in the red box and to put it into a column of a new table. PS: I know that it is possible to generate a table from the distribution with the command Make into Data Table but this command does not work on the number in the box.
Here is an example of one way to do this
names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
summarize( dt, levels = By( :Age ) );
dtNew = New Table( "Count",
Add Rows( 1 ),
New Column( "Count" )
);
dtNew:Count[1] = N Items( Levels );
Here is a second example that reads the Frequencies table directly and count the number of rows
names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
// Report snapshot: Big Class - Distribution of sex
dis = Data Table( "Big Class" ) << Distribution( Nominal Distribution( Column( :age ) ) );
dtNew = New Table( "Count2",
Add Rows( 1 ),
New Column( "Count" )
);
// Calculate the number of items in the Frequencies table, minus the
// the last row which is the Totals row
tableLevels = N Items( report(dis)["Frequencies",StringColBox(1)] << get ) - 1;
dtNew:Count[1] = tableLevels;
Here is an example of one way to do this
names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
summarize( dt, levels = By( :Age ) );
dtNew = New Table( "Count",
Add Rows( 1 ),
New Column( "Count" )
);
dtNew:Count[1] = N Items( Levels );
Here is a second example that reads the Frequencies table directly and count the number of rows
names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
// Report snapshot: Big Class - Distribution of sex
dis = Data Table( "Big Class" ) << Distribution( Nominal Distribution( Column( :age ) ) );
dtNew = New Table( "Count2",
Add Rows( 1 ),
New Column( "Count" )
);
// Calculate the number of items in the Frequencies table, minus the
// the last row which is the Totals row
tableLevels = N Items( report(dis)["Frequencies",StringColBox(1)] << get ) - 1;
dtNew:Count[1] = tableLevels;
After my question I managed to write the code with method two on my own but method one seems more convenient and immediate. Thank you!