cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
29755
Level II

Tabulate specific values from column

Hi all,

 

I have this Air Traffic.jmp file as my example, so what I wanted to do is to tabulate the data with only the specified values needed but it need to retain its original Column % value.

I tried selecting the needed values then subset into another table but ends up having 100 Column % value. I also tried hiding and excluding but also got 100 Column % value. 

 

In my attached file, my needed values for tabulating are Alaska, America West and American only.

Is there any ways to do this?

29755_0-1632996765607.png

 

3 REPLIES 3
txnelson
Super User

Re: Tabulate specific values from column

You will need to run Tabulate twice, and subset  the desired airline data between the tabulates

  1. Create the Tabulate as you have above
  2. Make the Tabulate display into a data table.  Go to the red triangle and select "Make into Data Table"
  3. In the new table, select the rows for Alaska, America West and American.
  4. Subset the data table using   Tables=>Subset  and keep only the selected rows
  5. On the new data table run the Tabulate platform.
    1. Drag the Airline column to the Drop Zone for Rows
    2. Drag the Column % column to the N  in the Statistic column
    3. Right click on the Column % label and select   "Remove Column Label"
    4. Right click on the Sum label and select  "Change Item Label"
    5. Change the label to   "Column %"

txnelson_0-1633000634238.png

 

Below is a script that performs the above operations

names default to here(1);

// Open Data Table: Air Traffic.jmp
// → Data Table( "Air Traffic" )
dt = Open( "$SAMPLE_DATA/Air Traffic.jmp" );

tab = dt << Tabulate(
	Add Table(
		Column Table( Statistics( Column % ) ),
		Row Table( Grouping Columns( :Airline ) )
	)
);
dtCalc = tab << make into data table;

dtCalc << select where( :Airline == "Alaska" | :Airline == "America West" | 
	:Airline == "American"
);

dtSub = dtCalc << Subset( selected rows( 1 ), selected columns( 0 ) );

dtSub << Tabulate(
	Remove Column Label( Analysis Columns( Column % ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Column % ), Statistics( Column % ) ),
		Row Table( Grouping Columns( :Airline ) )
	)
);

 

Jim
29755
Level II

Re: Tabulate specific values from column

Hi txnelson, thank you for your response.

However, is it possible that the Column% values would still be like this?

29755_0-1633045017170.png

 

 

txnelson
Super User

Re: Tabulate specific values from column

My Error or rather JMP's funky interpretation.  Because of the way Tabulate works, it uses the specific names to key actions, and by changing the label name to Column %, Tabulate recalculated the value.  So if the label is changed to "The Column %" it does not do the recalcuation.

txnelson_0-1633053150339.png

names default to here(1);

// Open Data Table: Air Traffic.jmp
// → Data Table( "Air Traffic" )
dt = Open( "$SAMPLE_DATA/Air Traffic.jmp" );

tab = dt << Tabulate(
	Add Table(
		Column Table( Statistics( Column % ) ),
		Row Table( Grouping Columns( :Airline ) )
	)
);
dtCalc = tab << make into data table;

dtCalc << select where( :Airline == "Alaska" | :Airline == "America West" | 
	:Airline == "American"
);

dtSub = dtCalc << Subset( selected rows( 1 ), selected columns( 0 ) );

dtSub << Tabulate(
	Change Item Label( Statistics( Sum, "The Column %" ) ),
	Remove Column Label( Analysis Columns( Column % ) ),
	Show Control Panel( 0 ),
	Add Table(
		Column Table( Analysis Columns( :Column % ) ),
		Row Table( Grouping Columns( :Airline ) )
	)
);

 

Jim