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

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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
  • 541 views
  • 0 likes
  • 2 in conversation