cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Learn some foundational elements of JMP Scripting Language (JSL) and how to extend point & click automation into repeatable, shareable routines. Register. June 26, 2 p.m. US Eastern Time.

Discussions

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

How can use JSL to loop column names into different variables?

Thanks!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For( i = 1, i <= N Col( dt ), i++,
	ca = Column( i ) << Get Name;
	Eval( Parse( "c" || Char( i ) || "=" || ca || "" ) );//?
);
a = c1;
b = c2;
1 REPLY 1
jthi
Super User

Re: How can use JSL to loop column names into different variables?

Usually something like this is a very bad idea and its much better idea to use something like list or associative array, but if you really want to do something like this you are missing quotes if you want to get the names

Names Default To Here(1);
Delete Symbols();

dt = Open("$SAMPLE_DATA/Big Class.jmp");
For(i = 1, i <= N Col(dt), i++,
	ca = Column(i) << Get Name;
	Eval(Parse("c" || Char(i) || "= \!"" || ca || "\!""));//?
);
Show Symbols();
-Jarmo

Recommended Articles