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.