cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
johnm
Level III

Subset By and accessing the :col values used in the subset

Hello,

 

When subset by is performed, the Table Panel will show the :cols and their values for the given subset data table.

How does user access this information using script command?

 

Example:

 

mysubdt = mymaindt << Subset (by ( :first_var, :sec_var, :third_var));  // each var has multiple levels, aka several values. 
// then mysubdt[1] through mysubdt[n] with n being the number of subset data tables created.

 

 

For each mysubdt[i], the Panel would show for example for one of the subset data tables:

first_var      abc

sec_var      xyz

third_var     123

 

The objective here is to then save each mysubdt[i] by doing a save that uses these variables' values.

mysubdt[1] << save ("dt_abc_xyz_123.jmp");

 

Just can't seem yet to find this table property information.

Other approaches?

 

Thanks,

John

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Subset By and accessing the :col values used in the subset

Try

mysubdtt[1] << save ("$mypath\" || filename || ".jmp");
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Subset By and accessing the :col values used in the subset

x=dt<<get table variable("first_var")
Jim
johnm
Level III

Re: Subset By and accessing the :col values used in the subset

Hi Jim,

 

Thanks for quick reply!

 

I subsequently create a string and filename variable:

fld1 = mysubdtt[1] << get table variable ("first_var");
fld2 = mysubdtt[1] << get table variable ("sec_var");
fld3 = mysubdtt[1] << get table variable ("third_var");

filename = "dt_"||(fld1)||"_"||(fld2)||"_"||(fld3);

 

in an attempt to then save as follows:

mysubdtt[1] << save ("$mypath\$filename.jmp"); 

 

but not quite working as the file saved to the mypath is "$filename.jmp".

 

John

 

txnelson
Super User

Re: Subset By and accessing the :col values used in the subset

Try

mysubdtt[1] << save ("$mypath\" || filename || ".jmp");
Jim
johnm
Level III

Re: Subset By and accessing the :col values used in the subset

Thanks again Jim!