cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
DarkWinter
Level I

Tabulate Page Column item specified from for loop

Hello all,

 

I am trying to tabulate multi cases based on a specific column value in for loop.

categorizes = Column(dt, "Categorize");
columnValues = Associative Array(categorizes << Get Values) << Get Keys;
For(i = 1, i <= N Items(columnValues), i++,
	currentItem = columnValues[i];
 
 
	obLoopY = Outline Box("categorize" || Char(currentItem),
		dt << Tabulate(
			Page Column(:Categorize(Char(currentItem))),
			Show Control Panel(0),
			Add Table(
				Column Table(
					Grouping Columns(:Underlayer, :RefEntity),
					Analysis Columns(:M3S_Y)
				),
				Row Table(Grouping Columns(:TargetEntity))
			),
			SendToReport(Dispatch({}, "", TextBox, {Set Base Font("Heading")}))
		)
	);
 
	boxY << append(obLoopY);
);
 
Problem is, the currentItem contains the columnValues from Categorize column.
If I just specify the item value, let's say "a" as one of columnValues.
I added Page Column( :Categorize( "a" ) ) into Tabulate method, then it works.
But I needed to run all values from for loop, I tried to make it Page Column( :Categorize( currentItem ) ), but it did not work and just gave me the whole value at once instead of splitting by currentItem.
 
I tried Page Column( :Categorize( currentItem ) ), Page Column( :Categorize( char(currentItem) ) ), but neither of them worked. Probably there is a very easy solution but I could not find it.
 
Anyone can help?
 
Thanks in advance
 
Edit (jthi): Added jsl formatting
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Tabulate Page Column item specified from for loop

You might have to evaluate the values, below is an example using JMP's sample table

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Summarize(dt, groups = By(:sex));

New Window("test", 
	collector = H List Box()
);

For Each({group}, groups,
	ob = Outline Box("Categorize " || group,
		tab = dt << Tabulate(
			Show Control Panel(0),
			Add Table(
				Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
				Row Table(Grouping Columns(:age))
			)
		);
		Eval(EvalExpr(
			tab << page column(:sex(Expr(group)));
		));
	);
	collector << Append(ob);
);

jthi_0-1757529291969.png

 

If the layout is fine, By might also be an option

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

tab = dt << Tabulate(
	Show Control Panel(0),
	Add Table(
		Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
		Row Table(Grouping Columns(:age))
	),
	By(:sex),
	Group Options(Layout("Horizontal List"))
);

jthi_1-1757529379300.png

 

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Tabulate Page Column item specified from for loop

You might have to evaluate the values, below is an example using JMP's sample table

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Summarize(dt, groups = By(:sex));

New Window("test", 
	collector = H List Box()
);

For Each({group}, groups,
	ob = Outline Box("Categorize " || group,
		tab = dt << Tabulate(
			Show Control Panel(0),
			Add Table(
				Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
				Row Table(Grouping Columns(:age))
			)
		);
		Eval(EvalExpr(
			tab << page column(:sex(Expr(group)));
		));
	);
	collector << Append(ob);
);

jthi_0-1757529291969.png

 

If the layout is fine, By might also be an option

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

tab = dt << Tabulate(
	Show Control Panel(0),
	Add Table(
		Column Table(Analysis Columns(:height, :weight), Statistics(Mean)),
		Row Table(Grouping Columns(:age))
	),
	By(:sex),
	Group Options(Layout("Horizontal List"))
);

jthi_1-1757529379300.png

 

 

-Jarmo
DarkWinter
Level I

Re: Tabulate Page Column item specified from for loop

Thanks using By also removes unnecessary for loop!

Recommended Articles