Variables in graph scriptis there a way to use variables to substitute names in JMP?
When I try the code below, it doesn't run. I will be making a for loop where I make a graph and change the Y axis so I'm really hoping there is a way this can work, rather than copying and pasting for every graph I'd want to output.
names = {"Hair Color", "Eye color", "Age", "Gender", "Age 1/2"};
graph = dt << Variability Chart(
Y( :Name(names[1])),
X( :City),
Std Dev Chart( 0 )
);
Re: Variables in graph script@mochar,
Ron, @ron_horne, provided a great solution: creating a list of column references.
You can also use column names as text. One example is shown below. Instead of name, I prefer to use Column().
dt = Open("$sample_data/big class.jmp");
names = {"height", "weight", "age", "sex"};
graph = dt << Variability Chart(
Y( column(names[1]) ),
X( column(names[3]) ),
By(Column(names[4]) ),
Std Dev Chart( 0 )
);
Just one more example.
Re: Variables in graph scriptHi @mochar
is this what you are looking for?
dt= Open( "$SAMPLE_DATA/Big Class.jmp" );
:weight << set name ("weight1/2") ;
cols = dt << Get Column Names( Continuous );
for (i=1, i<= n items (cols), i++,
Variability Chart( Y( cols[i] ), X( :age ) );
);
let us know if it works for you,
ron