I was trying to generate the control chart and save the lengthythe script to the data table at the same time. The control chart script is lengthy. So instead of doing copy & paste the long script shown below is there a sophisticated way to do it?
Any help appreciated.
Names Default To Here( 1 );
dt = Current Data Table();
Control Chart(
SendToByGroup( {:group == "A"} ),...
....
);
dt << New Script(
"Control Chart by weight",
Control Chart(
SendToByGroup( {:group == "A"} ),...
...
);
You need to use the command Save By Group script to data table.
dt=Open("$SAMPLE_DATA/Big Class.jmp");
obj=dt<<Control Chart(
Sample Label( :age ),
KSigma( 3 ),
Chart Col( :height, XBar, R ),
By( :sex )
);
obj[1]<<Save By Group script to data table;
You can save the script right with the generation of the Control Chart. Here is the example from the Scripting Index that shows you how you can do it. You can do the same with the code you displayed, without having to do a separate step.
Names Default To Here( 1 );
dt = Open(
"$SAMPLE_DATA/Quality Control/Coating.jmp"
);
obj = Control Chart(
Sample Size( 1 ),
Chart Col( :Weight ),
Chart Type( Run Chart )
);
obj <<
Save Script to Data Table(
"My Analysis",
<<Prompt( 0 ),
<<Replace( 0 )
);
In my original control charts I had "SendToByGroup(...." as part of the scripts.
If I do the following each plot is saved individually resulting in tens of scripts. Is there a way to fix it? Appreciated!
obj <<Save Script to Data Table(
"My Analysis",
<<Prompt( 0 ),
<<Replace( 0 )
)
You need to use the command Save By Group script to data table.
dt=Open("$SAMPLE_DATA/Big Class.jmp");
obj=dt<<Control Chart(
Sample Label( :age ),
KSigma( 3 ),
Chart Col( :height, XBar, R ),
By( :sex )
);
obj[1]<<Save By Group script to data table;