cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ben_ph
Level III

Display all grouping column values in Tabulate

Hi, I'm wondering if there is a way to show a value in every row of a grouping column when using Tabulate. For example in the table generated from the below, show a value for each row for country.

 

NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Car Poll.jmp");
obj = dt << Tabulate(
    Add Table(
        Column Table(Grouping Columns(:sex, :marital status)),
        Row Table(Grouping Columns(:country, :size))
    )
);

ben_ph_0-1646254456163.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Display all grouping column values in Tabulate

If you make the Tabulate table into a data table, you can then create a new window and use a Table Box() to create your desired output

Data Table from Tabulate

txnelson_0-1646271462050.png

Script to generate the Window with the Table Box()

Names Default To Here( 1 );
dt = Current Data Table();
New Window( "table",
	tb = Table Box(
		String Col Box( "Country", dt:country << get values ),
		String Col Box( "size", dt:size << get values ),
		Col Span Box(
			"Sex",
			Col Span Box(
				"Female\!nMarital Status",
				Number Col Box( "Married", dt:Female Marital Status married << get values ),
				Number Col Box( "Single", dt:Female Marital Status single << get values )
			),
			Col Span Box(
				"Male\!nMarital Status",
				Number Col Box( "Married", dt:male Marital Status married << get values ),
				Number Col Box( "Single", dt:male Marital Status single << get values )
			)
		)
	)
);

What the output looks like

txnelson_1-1646271613130.png

 

 

Jim

View solution in original post

2 REPLIES 2
Georg
Level VII

Re: Display all grouping column values in Tabulate

If you "Make into data table" under red triangle menu of tabulate, the resulting data table would have a country in every row. Perhaps this helps?

Georg
txnelson
Super User

Re: Display all grouping column values in Tabulate

If you make the Tabulate table into a data table, you can then create a new window and use a Table Box() to create your desired output

Data Table from Tabulate

txnelson_0-1646271462050.png

Script to generate the Window with the Table Box()

Names Default To Here( 1 );
dt = Current Data Table();
New Window( "table",
	tb = Table Box(
		String Col Box( "Country", dt:country << get values ),
		String Col Box( "size", dt:size << get values ),
		Col Span Box(
			"Sex",
			Col Span Box(
				"Female\!nMarital Status",
				Number Col Box( "Married", dt:Female Marital Status married << get values ),
				Number Col Box( "Single", dt:Female Marital Status single << get values )
			),
			Col Span Box(
				"Male\!nMarital Status",
				Number Col Box( "Married", dt:male Marital Status married << get values ),
				Number Col Box( "Single", dt:male Marital Status single << get values )
			)
		)
	)
);

What the output looks like

txnelson_1-1646271613130.png

 

 

Jim