Insert list of column names into a formulaHi,
I am making a script creating about 14 different journals. I have maybe 10 different sets of data that am going to prepare and for each for each journal I would like to update specific data from other tables and then also chart the specific data. The chart settings for my script are more complicated than the sample script I supplied. Please help me figure out how use a variable for the column names in my script. I've tried a bunch of combinations of Parse, eval and expr and couldn't get it to work
Would like to do something like this:
table1 = open("$SAMPLE_DATA/students1.jmp");
table2 = open("$SAMPLE_DATA/students2.jmp");
ins = ":height, :weight";
table1 << Update(With( table2 ),
Match Columns( :name = :name ),
Add Columns from Update table( parse(ins) ));
Current Data Table(table1);
Scatterplot Matrix(
Y( parse(ins) ),
X( :sex ),
Matrix Format( "Lower Triangular" ),
Ellipse Color( 3 ),
Fit Line( 0 )
);and result I would like to be like this:
table1 = open("$SAMPLE_DATA/students1.jmp");
table2 = open("$SAMPLE_DATA/students2.jmp");
table1 << Update(With( table2 ),
Match Columns( :name = :name ),
Add Columns from Update table( :height, :weight ));
Current Data Table(table1);
Scatterplot Matrix(
Y( :height, :weight ),
X( :sex ),
Matrix Format( "Lower Triangular" ),
Ellipse Color( 3 ),
Fit Line( 0 )
);Re: Insert list of column names into a formulaHere is an old school way of handling your issue
names default to here(1);
table1 = open("$SAMPLE_DATA/students1.jmp");
table2 = open("$SAMPLE_DATA/students2.jmp");
ins = ":height, :weight;";
eval(parse(
"table1 << Update(With( table2 ),
Match Columns( :name = :name ),
Add Columns from Update table( "||ins||" ));"));
Current Data Table(table1);
Scatterplot Matrix(
Y( parse(ins) ),
X( :sex ),
Matrix Format( "Lower Triangular" ),
Ellipse Color( 3 ),
Fit Line( 0 )
);Re: Insert list of column names into a formulaHi Jim,
How would I do the scatter plot using the same method? One of the scatterplot parameters has quotation marks. Thanks!
Re: Insert list of column names into a formula\! is the escape sequence in JMP, therefore, as can be seen in the below script, \!" is used to embedd a double quote in a quoted string
theExpr = (
"Bivariate( Y( :height ), X( :weight ),
Where( :sex == \!"F\!" ) );"
);
eval(Parse(theExpr));
All of this is covered in the Scripting Guide. I strongly recommend tthat you take the time to read it.
Help==>Books==>Scripting Guide
Re: Insert list of column names into a formulaThank You