Standardized Group column attributesHello. I'm new to jsl scripts.
From scripting help menu, I can transfrom column attributes but how do I do that for all columns in the group?
It's too clunky to write all 20 columns one by one and I have many grouped columns.
I know its easy to just use standardize attributes without scripting but I'm dealing with joined tables that gets updated frrequently and its not productive to do that all the time.
dt << Transform Column( "A");
dt:A << Data Type( Numeric);
dt:A << Modeling Type( "Continuous" );
I tried changing Column to Column Group, its doesnt seem to work..
Automation and ScriptingRe: Standardized Group column attributesI believe this will do what you need:
Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column group( "the group's name" );
For Each( {col},
colNames, Column( dt, col ) << Data Type( Numeric ) << Modeling Type( Continuous )
);
Please use the
when entering JSL. It allows the readers to have an easier time examining the JSL
Re: Standardized Group column attributesYou can use Standardize Attributes as your starting point and modify the script it creates as needed.
I have columns like this and I wish to change height and weight to character type columns

Standardize attributes will give me a script like this (from enhanced log)
// Standardize column attributes
Local({old dt = Current Data Table()},
Current Data Table(Data Table("Big Class"));
For Each({col, index}, {:height, :weight},
col << Data Type(Character) << Set Modeling Type("Nominal")
);
Current Data Table(old dt);
);
Next search scripting index for column group (or something similar)

after small modification (I change data type and modeling type back to numeric)
// Standardize column attributes
Local({old dt = Current Data Table()},
Current Data Table(Data Table("Big Class"));
For Each({col, index}, old dt << get column group("height etc."),
col << Data Type(Numeric) << Set Modeling Type("Continuous")
);
Current Data Table(old dt);
);
If you don't know the column group name, the it is back to scripting index

Re: Standardized Group column attributesThank you!
How do I get the enhanced log? Is it available in JMP 16? I havent upgraded yet
Re: Standardized Group column attributesThank you
Next time i will use
I tried the script but i got this alert instead. what shoud i do?

Re: Standardized Group column attributesYes, it was added in JMP16 and each version since then is able to capture more actions (and JMP17 has workflow builder).
Re: Standardized Group column attributesThat script is also using For Each which was also added in JMP16. You would have to convert it into For loop which would look something like this
Local({old dt = Current Data Table()},
Current Data Table(Data Table("Big Class"));
collist = old dt << get column group("height etc.");
For(i = 1, i <= N Items(collist), i++,
col = collist[i];
col << Data Type(Numeric) << Set Modeling Type("Nominal");
);
Current Data Table(old dt);
);
Depending where the script is being run, it could also be cleaned (at least in my opinion) a bit to something like this
Names Default To Here(1);
dt = Current Data Table();
// dt = Open(); // use this if possible
collist = dt << get column group("height etc.");
For(i = 1, i <= N Items(collist), i++,
col = collist[i];
col << Data Type(Numeric) << Set Modeling Type("Continuous");
);