cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level IX

在脚本中如何用列号来代替列名称?

 例如: 以下脚本是选取年龄是13岁的姓名、身高、体重列数据

 

在脚本中如何表示 用第4列、第5列来分别代替"身高"、"体重"列?

感谢帮助!

2021-09-13_220141.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

回复: 在脚本中如何用列号来代替列名称?

You can use the Column() function

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( age == 13 );
dt << Select Columns( "name", "height", "weight" );
d3 = dt << Subset( Output Table( "A" ), Selected Rows( 1 ), columns( column(4), column(5) ));
Jim

View solution in original post

lwx228
Level VIII

回复: 在脚本中如何用列号来代替列名称?

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( age == 13 );
c1 = Column( 1 ) << Get Name;
c2 = Column( 4 ) << Get Name;
c3 = Column( 5 ) << Get Name;
dt << Select Columns( c1, c2, c3 );
d3 = dt << Subset( Output Table( "A" ), Selected Rows( 1 ), columns( Column( 1 ), Column( 4 ), Column( 5 ) ) );

View solution in original post

4 REPLIES 4
lala
Level IX

回复: 在脚本中如何用列号来代替列名称?

jsl

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( age == 13 );
dt << Select Columns( "name", "height", "weight" );
d3 = dt << Subset( Output Table( "A" ), Selected Rows( 1 ), columns( name, height, weight ) );
txnelson
Super User

回复: 在脚本中如何用列号来代替列名称?

You can use the Column() function

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( age == 13 );
dt << Select Columns( "name", "height", "weight" );
d3 = dt << Subset( Output Table( "A" ), Selected Rows( 1 ), columns( column(4), column(5) ));
Jim
lala
Level IX

回复: 在脚本中如何用列号来代替列名称?

dt << Select Columns( "name", "height", "weight" );

Could the  "height and weight" in this line of code also be replaced with column numbers?

 

Thanks Experts!

lwx228
Level VIII

回复: 在脚本中如何用列号来代替列名称?

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( age == 13 );
c1 = Column( 1 ) << Get Name;
c2 = Column( 4 ) << Get Name;
c3 = Column( 5 ) << Get Name;
dt << Select Columns( c1, c2, c3 );
d3 = dt << Subset( Output Table( "A" ), Selected Rows( 1 ), columns( Column( 1 ), Column( 4 ), Column( 5 ) ) );

Recommended Articles