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
frankzhao
Level II

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
Highlighted
ron_horne
Super User

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 ) )

    )

);

View solution in original post

2 REPLIES 2
Highlighted
ron_horne
Super User

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 ) )

    )

);

View solution in original post

Highlighted
frankzhao
Level II

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

This script can work,Thank you