scripting categorical analysis of multiple columnsHello,
I have a data table (in attachment) with the first column (COD CAMP) that is always the same but the other columns can be different in different tables (different number and different names). I want to script the categorical analysis of the other columns vs. COD CAMP. In this way may analysis will work whatever the data table is (of course it must contain COD CAMP). I tried the following jsl code with several variants but without success. Can anyone help? Many thanks.
dt3 = Current Data Table();
n3 = dt3 << Get Column Names();
Show( n3 );
lstColNames_n3 = dt3 << Get Column Names();
Show( lstColNames_n3 );
Show( lstCols_n3 );
lstCols_n3 = {};
For( i = 1, i <= N Items( lstColNames_n3 ), i++,
colName = lstColNames_n3[i];
col = Column( dt3, i );
Insert Into( lstCols_n3, col );
);
Show( lstCols_n3 );
For( i = 1, i <= N Items( lstColNames_n3 ), i++,
colName = lstColNames_n3[i];
col = Column( dt3, colName );
Insert Into( n2, col );
);
dt3 << New Script(
"Categorical by COD CAMP",
Categorical( X( :COD CAMP ), Responses( Eval( n2 ) ), Legend( 0 ) )
);
ScriptingRe: scripting categorical analysis of multiple columnsHere is a solution to your question.
Most of the code that you supplied repeated the same retrieval of column names multiple times. I suspect you do not understand what the code is doing. The script below simplifies your script.
Names Default To Here( 1 );
dt3 = Current Data Table();
n3 = dt3 << Get Column Names();
Remove From( n3, 1, 1 );
Eval(
Parse(
Eval Insert(
"\[
dt3<<NEW script=""></NEW>
I strongly suggest that you take the time to read the Scripting Guide.
Re: scripting categorical analysis of multiple columnsHello Jim,
I appreciate your help. I am not expert in JSL, I try to extract the code from JMP and from suggestions posted on the JMP community. I am aware that there are some repetitions in the code, sorry for not having cleaned it. This type of coding (probably with some differences because at some point I tried to change different things with a trial and error procedure) worked for some platforms when I have a list of columns (list of references or list of names.. depending on the platform if I remember well) but not for others. For sure I have to go deeper in JSL coding... But so far it has given me a lot of satisfaction!!
I tried the code you wrote but the analysis is performed only for the fist attribute (INTENSITA' PROFUMO IN APPLICAZIONE), not for all of them. I do not receive any error message.
Many thanks for your time,