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

Simplify JSL in transpose column #

Hi I am trying to reduce the transpose JSL columns.

Currently, when transpose col from col (3) to col (8), each col needs to be listed specifically.

Can I convert it to transpose between col (3) and col (8)? without list each column name.

Thanks

dt = Current Data Table();
dt << Transpose(
	columns(
		Column( 3 ),
		Column( 4 ),
		Column( 5 ),
		Column( 6 ),
		Column( 7 ),
		Column( 8 )
	)
);
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Simplify JSL in transpose column #

Here is one way to do what you want

dt = Current Data Table();
colNames = (dt << get column names(string))[3::8];
dt << Transpose(
	columns(
		colNames
	)
);
Jim

View solution in original post

ErraticAttack
Level VI

Re: Simplify JSL in transpose column #

You can index the columns by number:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Blood Pressure.jmp" );
dt << Transpose( Columns( 2::6 ), By( :Dose ), Label( :Subject ) );
Jordan

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Simplify JSL in transpose column #

Here is one way to do what you want

dt = Current Data Table();
colNames = (dt << get column names(string))[3::8];
dt << Transpose(
	columns(
		colNames
	)
);
Jim
ErraticAttack
Level VI

Re: Simplify JSL in transpose column #

You can index the columns by number:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Blood Pressure.jmp" );
dt << Transpose( Columns( 2::6 ), By( :Dose ), Label( :Subject ) );
Jordan
Stokes
Level IV

Re: Simplify JSL in transpose column #

Hi, Both solution works great