Choose Language Hide Translation Bar
Highlighted
lwx228
Community Trekker

How can I copy a new table data copy with column names to after the last column of another table?

For example, the Boston Housing.jmp Summary calculation produces a new table that wants to copy all the column names and data from the new table to the first row after the last column of Boston Housing.jmp.Thank you very much!

 

dt = Open( "$SAMPLE_DATA/Boston Housing.jmp" );
dt << Summary(
Group( :chas, :tax ),
Mean( :mvalue ),
Subgroup( :radial ),
Freq( "None" ),
Weight( "None" )
)

……??

 

2018-08-22_18-16-24.png

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Staff

Re: How can I copy a new table data copy with column names to after the last column of another table

I'm not sure that putting summary and raw data in the same table is necessarily a good idea. But, if you need to for some reason (and if I have understood correctly), then you can use 'Tables > Join' with 'By Row Number'. In JSL:

 

Names Default To Here( 1 );

// First table
dt1 = Open( "$SAMPLE_DATA/Boston Housing.jmp" );

// Summary table
dt2 = dt1 << Summary(
	Group( :chas, :tax ),
	Mean( :mvalue ),
	Subgroup( :radial ),
	Freq( "None" ),
	Weight( "None" )
);

// Joined table
dt3 = dt1 << Join( With( dt2 ), By Row Number, Output Table( "Joined Data" ) );

 

View solution in original post

4 REPLIES 4
lwx228
Community Trekker

Re: How can I copy a new table data copy with column names to after the last column of another table

2018-08-22_18-16-24.png

0 Kudos
ian_jmp
Staff

Re: How can I copy a new table data copy with column names to after the last column of another table

I'm not sure that putting summary and raw data in the same table is necessarily a good idea. But, if you need to for some reason (and if I have understood correctly), then you can use 'Tables > Join' with 'By Row Number'. In JSL:

 

Names Default To Here( 1 );

// First table
dt1 = Open( "$SAMPLE_DATA/Boston Housing.jmp" );

// Summary table
dt2 = dt1 << Summary(
	Group( :chas, :tax ),
	Mean( :mvalue ),
	Subgroup( :radial ),
	Freq( "None" ),
	Weight( "None" )
);

// Joined table
dt3 = dt1 << Join( With( dt2 ), By Row Number, Output Table( "Joined Data" ) );

 

View solution in original post

lwx228
Community Trekker

Re: How can I copy a new table data copy with column names to after the last column of another table

Excellent answer, thank you!
0 Kudos
Thomas1
Community Trekker

Re: How can I copy a new table data copy with column names to after the last column of another table

Hi Ian,

 

this is an interesting topic. Is there away to add the summary data table to the source data table in order to have only one file (script table)?

What JSL must be applied to add the resulting means in one column and the N Rows as well in another column to the source data table?

The main interest here is to keep the summary data results in the origin source data table.

0 Kudos