cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

How do I update a column based on values from another column?

Hello,

 

I'm a JMP 18 user.

I want to see if a column contains a specific value and update a different column at the same row where the value was found. The below script does not work. Please assist.

dt = Data Table("Logbook");
StatusList = :Status << Get Values;
For( i = 1, i <= N Items(StatusList), i++,
	If( Contains( StatusList, "Not" ), 
		:Name( "Status Error" )[i] = "Error",	
	, //else
	);
);
1 ACCEPTED SOLUTION

Accepted Solutions
mmarchandFSLR
Level VI

Re: How do I update a column based on values from another column?

If I understand what you are looking for, this script should do it.  It only changes :Status Error to "Error" where :Status == "Not" and leaves other entries alone.

 

Names Default to Here( 1 );
dt = Data Table( "Logbook" );
For Each Row( dt, If( :Status == "Not", :Status Error = "Error" ) );

View solution in original post

1 REPLY 1
mmarchandFSLR
Level VI

Re: How do I update a column based on values from another column?

If I understand what you are looking for, this script should do it.  It only changes :Status Error to "Error" where :Status == "Not" and leaves other entries alone.

 

Names Default to Here( 1 );
dt = Data Table( "Logbook" );
For Each Row( dt, If( :Status == "Not", :Status Error = "Error" ) );

Recommended Articles