Subscribe Bookmark RSS Feed

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

jkelleyjr

New Contributor

Joined:

Aug 27, 2016

As above

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

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
3 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

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
Solution

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
jkelleyjr

New Contributor

Joined:

Aug 27, 2016

@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