Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
thebilly31
Level I

Looking for the column number?

Hi there, I am trying to display all the SPSS names of the columns as I can select in the column info (see below). 

Is that possible? 

 

Other question: I want to access a specific cell given the specific columnnumber and rownumber. How can I do that?

 

Thank you.

 

image.png

 

(right-klick on column name>column info)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Looking for the column number?

There is a JMP Preference in the Tables section of the Preferences called "Show Alternate Column Name".  When this Preference is selected, the column name will be made up of a concatenation of the SPSS Name and SPSS Label, when the data table is created.  But short of that, the only interactive method I am aware of is to go through each column, and copy the value of the SPSS Name, and paste it into the column name.

However, the following script, will quickly go through each column and change the column name to the value of the SPSS Name, if an SPSS Name exists

.

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Cols( dt ), i++,
	If( Is Empty( Column( dt, i ) << get property( "SPSS Name" ) ) == 0,
		Column( dt, i ) << set name( Char( Column( dt, i ) << get property( "SPSS Name" ) ) )
	)
);
Jim

View solution in original post

4 REPLIES 4
Highlighted
txnelson
Super User

Re: Looking for the column number?

I am not quite sure what you asking for when you say you want to be able to

     "display all the SPSS names".

Where do you want to display the names?  Do you want to change the column names in the data table to have the SPSS Names?

On the second question there are a few different ways to access a specific cell in a data table with the column number and row number

names default to here( 1 );
dt = current data table();

show( dt[ 5, 4] );

show( column( dt, 4 )[5] );
Jim
Highlighted
thebilly31
Level I

Re: Looking for the column number?

Thank you.

Yes, I want to change the column names to the SPSS names. How can I do that? 

 

Is there an easy klicky-way, using the mouse only? My coding skills in JMP are non existent. (I am using JMP for data-transfer only.)

Highlighted
txnelson
Super User

Re: Looking for the column number?

There is a JMP Preference in the Tables section of the Preferences called "Show Alternate Column Name".  When this Preference is selected, the column name will be made up of a concatenation of the SPSS Name and SPSS Label, when the data table is created.  But short of that, the only interactive method I am aware of is to go through each column, and copy the value of the SPSS Name, and paste it into the column name.

However, the following script, will quickly go through each column and change the column name to the value of the SPSS Name, if an SPSS Name exists

.

Names Default To Here( 1 );
dt = Current Data Table();
For( i = 1, i <= N Cols( dt ), i++,
	If( Is Empty( Column( dt, i ) << get property( "SPSS Name" ) ) == 0,
		Column( dt, i ) << set name( Char( Column( dt, i ) << get property( "SPSS Name" ) ) )
	)
);
Jim

View solution in original post

Highlighted
thebilly31
Level I

Re: Looking for the column number?

You're awesome. 

Thank you! Really.

 

 

Article Labels

    There are no labels assigned to this post.