I would like to obtain the formula of each column in a more readable format (also called pretty format).
For the example below I will like to obtain "height / weight".
Simply removing ":" will not work as columns can have such character.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col = New Column( "Ratio" );
col << Set Formula( :height / :weight );
col << Eval Formula;
result = col << Get Formula;
Show( result );
// result = :height / :weight;
// desired_result = "height / weight";
Here is an example on how to do that
names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");
dt<< new column("Example", formula(sqrt(:Height/:Age+:Weight*:Height)));
new window("pretty", expr as picture(dt:Example << get formula));
Try this
names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");
dt<< new column("Example", formula(sqrt(:Height/:Age+:Weight*:Height)));
charFormula = char(dt:Example << get formula);
substitute into(charFormula,
expr(":"), expr(" ")
);
show(charFormula);
JSL syntax requires colons to refer to columns, but there are other options such as what I show here.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "Ratio", Set Formula( ascolumn("height") / ascolumn("weight")));
Not sure if it's more pretty though :)