BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BarryP
Quartz | Level 8

Hi all, 

I'm on version 8.5 V.03.05

I'm trying to create a new column that denotes whether or not a DEVICE is classified as an 'Instrument'.  I'm struggling to get the syntax correct.  This is what I have:

Step 1:  Select Data
Step 2:  Select + new data Item 
Step 3:  Select Calculated Item
Step 4:  Write script

'DEVICE'n contains 'Instrument'


I get an error message:

X  Type mismatch: expected type at this location is Character, type of item being applied is Boolean


Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
BarryP
Quartz | Level 8
I think I figured it out:

IF ( 'DEVICE'n = 'Instrument' )
RETURN 1
ELSE 0

View solution in original post

2 REPLIES 2
BarryP
Quartz | Level 8
I think I figured it out:

IF ( 'DEVICE'n = 'Instrument' )
RETURN 1
ELSE 0
Sam_SAS
SAS Employee

Hi Barry,

 

Glad you were able to get it working. If you have more values that you need to deal with, you will find that the IN condition is useful.

 

Another approach is to create a custom category, which will be more of a "click and drag" experience and less a coding one. Each way has its pros and cons. If you are creating more than a boolean/binary assignment, the nested IF statements in the calculated item approach can get tedious.

 

Sam

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 944 views
  • 0 likes
  • 2 in conversation