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
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