BookmarkSubscribeRSS Feed
frankzhao

Community Trekker

Joined:

Oct 13, 2014

How to add analysis columns based on the column's data type?

Hi,guys,

When we are using Tabulate function,is there any way for us to add analysis columns based on the data type?

I mean,for example,now I have a raw table with 1 column who's data type is character,all others are Numeric.But the number of Numeric columns would change because another script.I want to add all the Numeric columns as analysis columns when using Tabulate no matter what are the column names and how many Numeric columns there are.

,Is there any way to realise this by writing JSL script?

Thanks for help.

1 ACCEPTED SOLUTION

Accepted Solutions
ron_horne

Super User

Joined:

Jun 23, 2011

Solution

Re: How to add analysis columns based on the column's data type?

hi there,

try this.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// make a list of the continuous columns in the data table

CNames = dt << Get Column Names( Continuous );

Tabulate(

    Add Table(

        Column Table( Grouping Columns( :age ) ),

        Row Table( Analysis Columns( Eval( CNames ) ), // plant the list of columns in the formula

        Statistics( N, Mean, Std Dev ) )

    )

);

2 REPLIES
ron_horne

Super User

Joined:

Jun 23, 2011

Solution

Re: How to add analysis columns based on the column's data type?

hi there,

try this.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

// make a list of the continuous columns in the data table

CNames = dt << Get Column Names( Continuous );

Tabulate(

    Add Table(

        Column Table( Grouping Columns( :age ) ),

        Row Table( Analysis Columns( Eval( CNames ) ), // plant the list of columns in the formula

        Statistics( N, Mean, Std Dev ) )

    )

);

frankzhao

Community Trekker

Joined:

Oct 13, 2014

Re: How to add analysis columns based on the column's data type?

This script can work,Thank you