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
Jemster
Level III

Loop for Recode

I have several columns of data with numbers in.

When I import the data from excel some columns get imported as strings.

I would like to be able to loop through all columns and change their data type to integer.

The below script is an attempt to change one column.

col_list = dt << Get Column Names ()

dt << Begin Data Update;
dt << Recode Column(
	dt;col_list[21],
	{Num( _rcNow )},
	Update Properties( 1 ),
	Target Column( ;col_list[21] )
);
dt << End Data Update;

The command  below gives the right column but the code above gives an error on line 5 stating "Source column cannot be found in access or evaluation of 'Glue' , dt; /*###*/col_list[21] /*###*/;" I was wondering if I had to write the code as an expression then evaluate it and substitute the column into the relevant parts.

Show(dt;col_list[2]);
1 ACCEPTED SOLUTION

Accepted Solutions
Jemster
Level III

Re: Loop for Recode

I found replacing 'dt;col_lis[21]' with 'as column(col_list[21])' solved my problem

View solution in original post

1 REPLY 1
Jemster
Level III

Re: Loop for Recode

I found replacing 'dt;col_lis[21]' with 'as column(col_list[21])' solved my problem

Recommended Articles