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
ENTHU
Level IV

Help with error message - Argument is wrong type in access or evaluation of 'Contains'

I need to check if the columns contain either of the 2 strings and then replace column value with value in another column.

Here's the code -

For(i=1,i<= NRows(dt),i++,
if(contains(:step[i],"NA")| contains(:step[i],".") ,
:step[i] = description[i];
)

);

 

But I get an error saying - argument is wrong type in access or evaluation of 'Contains'

What am I doing wrong here?

1 REPLY 1
txnelson
Super User

Help with error message - Argument is wrong type in access or evaluation of 'Contains'

I beleive the issue is that your column called "description" is not properly being scoped.  It needs to have a ":" in front of its reference ":description".

Here is an example using a sample data table, that does what you want

Names Default To Here( 1 );
dt = Open("$SAMPLE_DATA/Big Class.jmp");
For( i = 1, i <= N Rows( dt ), i++,
	If( Contains( :Name[i], "TIM" ) | Contains( :Name[i], "ROBERT" ),
		:Name[i] = :Sex[i]
	)
);
Jim

Recommended Articles