We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted
ENTHU
Level III

how to loop through by variable while plotting variable plots

Hi,

I am trying to plot multiple variable charts where Y axis is different columns containing MIP in the column name.I have a column called step name and I need these plots for different step names.

Eg: MIP1 for stepA and stepB and so on.

I can use "By" variable while creating the plots.But how do I extend this to multiple steps. 

 

dt = Open( "C:\REPORT.csv" );
a = "MIP_";
col = dt << get column names( string );
nc = N Items( col );
theo_params = {};
For( i = 1, i <= nc, i++,
If( Contains( col[i], a ),
Insert Into( theo_params, col[i] )
)
);

Print(theo_params);





nw = New Window( "theo data", container = V List Box() );

For ( i=1, i<=N items(theo_params), i++,
content = V List Box(
dt << Variability Chart(
Y( Column(dt,theo_params[i]) ),
X( :CAUSE,:M_ID, :S_ID, :HEAD_ID ),
Show Range Bars( 0 ),
Show Cell Means( 0 ),
Std Dev Chart( 0 ),
SendToReport(
Dispatch(
{__VarChart__},
"2",


)
)
)




);
container << Append(content)
);
3 REPLIES 3
Highlighted
MichelleG
Level III

Re: how to loop through by variable while plotting variable plots

If you can make the plot you want using the Variability Chart tool (or anywhere else in JMP), you can always extract the script to do it from the little red triangle menu and find which part of the code corresponds to the changes you made. If I'm reading your question right, I think you want to insert a Where() argument in the Variability Chart function. If you had a step_list variable and you were looping over it with j as an index variable, it'd look something like this in each call to Variability Chart:

 

...
Y( Column(dt,theo_params[i]) ),
X( :CAUSE,:M_ID, :S_ID, :HEAD_ID ),
Where(:Step Name == step_list[j]),
...

 

Highlighted
txnelson
Super User

Re: how to loop through by variable while plotting variable plots

Below is a real simple expansion on your specified method.  It shows one way to develop output with more than one platform, across multiple columns.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

colNamesList = dt << get column names( continuous, string );

nw = New Window( "theo data", V List Box( hlb1 = H List Box(), hlb2 = H List Box() ) );

For( i = 1, i <= N Items( colNamesList ), i++,
	discontent = V List Box(
		Distribution(
			Continuous Distribution( Column( Column( dt, colNamesList[i] ) ) )
		)
	);
	hlb1 << append( discontent );
	onewaycontent = V List Box(
		oneway( x( :sex ), y( Column( dt, colNamesList[i] ) ) )
	);
	hlb2 << append( onewaycontent );
);
Jim
Highlighted
ENTHU
Level III

Re: how to loop through by variable while plotting variable plots

I didnt have to use any loop.Just adding By Step name did the trick.