cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
John_K
Level II

Is there a way to save a subsetted table back to the originating / primary table (similar to save script) ?

As above

1 ACCEPTED SOLUTION

Accepted Solutions
Phil_Brown
Super User (Alumni)

Re: Is there a way to save a subsetted table back to the originating / primary table (similar to save script) ?

jkelleyjr

If you created the subset interactively, then you could do the following.

1. Notice that each table spawned from its parent ends up with a Table Script called "Source". Click on the red triangle of "Source" and select "Copy".

12643_Screen Shot 2016-08-27 at 5.22.24 PM.png

2. Go back to the parent table and right-click in the upper-left corner and select "Paste":

12644_Screen Shot 2016-08-27 at 5.24.18 PM.png

3. The "Source" script for the subset is now a Table script in the parent table. You can always rename it as you like.

-PBZ

PDB

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Is there a way to save a subsetted table back to the originating / primary table (similar to save script) ?

Here is a sample script that will do the trick:

Names Default To Here( 1 );

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

dt << select where( :SEX == "F" );

dtsubset = dt << subset( selected rows( 1 ), selected columns( 0 ), output table name( "The Subset" ) );

Eval(Substitute(

              Expr(

           dt << new script( "Subset Script", __script__ )

              ),

       Expr( __script__ ), dtsubset << get script

));

Jim
Phil_Brown
Super User (Alumni)

Re: Is there a way to save a subsetted table back to the originating / primary table (similar to save script) ?

jkelleyjr

If you created the subset interactively, then you could do the following.

1. Notice that each table spawned from its parent ends up with a Table Script called "Source". Click on the red triangle of "Source" and select "Copy".

12643_Screen Shot 2016-08-27 at 5.22.24 PM.png

2. Go back to the parent table and right-click in the upper-left corner and select "Paste":

12644_Screen Shot 2016-08-27 at 5.24.18 PM.png

3. The "Source" script for the subset is now a Table script in the parent table. You can always rename it as you like.

-PBZ

PDB
John_K
Level II

Re: Is there a way to save a subsetted table back to the originating / primary table (similar to save script) ?

@PBZ  Perfect, exactly what I was looking for !!

Although I was hoping that functionality would be built into the red triangle in the sub-setted table natively, i.e.:

Subset of Data Table (red triangle) -> Save Subset Table to Data Table