cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

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