cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Due to the recently reported Microsoft outage, users may be temporarily unable to access My JMP or experience a delay receiving their verification codes. If you have previously installed JMP on your computer, this outage should not impact your ability to access the software. My JMP services will be restored as soon as Microsoft resolves this issue.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Script to Create Subset and Add Columns

New to scripting here, and trying to automate some of my work tasks.

 

My goal is to create multiple subsets from a master file and add some columns that will allow me to factorize the data.  Right now I am playing around with the data trying to learn.  Here's what I have: 

 

//Select data table
dt = Open( "FM_OwnshipState.jmp" );
//Card1
dt << Select Where( :LocalTime >= 6:59:00 & :LocalTime <= 6:59:05 );
dt << Subset( Output Table( "Card1.jmp" ), Selected Rows( 1 ), selected columns( 0 ) );
dt1 = ( "Card1.jmp" );
Current Data Table ( dt1 );
dt1 << New Column ( "Pub", After Last, Character );
dt1 << New Column ( "Beer", After Last, Character );
dt1 << New Column ( "Drink", After Last, Character );

It seems I can create the new subset, but it does not add the new columns to the subset of the data.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Script to Create Subset and Add Columns

You made it too complicated.

 

//Select data table
dt = Open( "FM_OwnshipState.jmp" );
//Card1
dt << Select Where( :LocalTime >= 6:59:00 & :LocalTime <= 6:59:05 );
dt1 = dt << Subset( Output Table( "Card1.jmp" ), Selected Rows( 1 ), selected columns( 0 ) );
dt1 << New Column ( "Pub", After Last, Character );
dt1 << New Column ( "Beer", After Last, Character );
dt1 << New Column ( "Drink", After Last, Character );

View solution in original post

2 REPLIES 2

Re: Script to Create Subset and Add Columns

You made it too complicated.

 

//Select data table
dt = Open( "FM_OwnshipState.jmp" );
//Card1
dt << Select Where( :LocalTime >= 6:59:00 & :LocalTime <= 6:59:05 );
dt1 = dt << Subset( Output Table( "Card1.jmp" ), Selected Rows( 1 ), selected columns( 0 ) );
dt1 << New Column ( "Pub", After Last, Character );
dt1 << New Column ( "Beer", After Last, Character );
dt1 << New Column ( "Drink", After Last, Character );
mjvincent87
Level II

Re: Script to Create Subset and Add Columns

Good stuff, thank you!

Recommended Articles