cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
] />

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Jo_E
Level III

Adressing a variable number of columns as Y-axis

I have a variable number of columns starting with "Alaska " on this follows a number starting from 01 to a variable maximum, e.g. 11.
I would like to have all these on the same Y column in a graph and the graph should be generated by the script.

I would be interested in the required code for adressing the variable number of Alaskas as Y column in the graph.

So the script should deliver an equivalent to this:
Y( :"Alaska 01"n ),
Y( :"Alaska 02"n, Position(1) ),
...
Y( :"Alaska 11"n, Position(1) ),

It would eb great if someone could help solving this issue.

1 REPLY 1
jthi
Super User

Re: Adressing a variable number of columns as Y-axis

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

prefix = "NPN";
cols = dt << Get Column Names("String");

collist = Filter Each({colname}, cols, Starts With(colname, prefix));


gb = Graph Builder(Parallel Axis Merging("Always"));
For Each({colname}, collist,
	Eval(EvalExpr(
		gb << Add Variable({Expr(NameExpr(AsColumn(dt, colname))), Role("Y"), Position(1)});
	));
);

Write();
-Jarmo

Recommended Articles