BookmarkSubscribeRSS Feed
shalatemasinge
Calcite | Level 5

I need to create a calculated column in SAS Viya using case statement

see below how I want the results

 

case Q4_1_WebSite_Experience
when '1' then 'Irritated'
when '2' then 'Dissapointed'
when '3' then 'Neutral'
when '4' then 'Satisfied'
when '5' then 'Delighted'
else 'None'
end as WebSite_Experience

1 REPLY 1
Sam_SAS
SAS Super FREQ

Hello,

 

The expression syntax for VA is limited compared to other systems. In a calculated item, you would need to use nested IF statements. Not very elegant but it works.

 

You could achieve the same result by using a custom category , which is a more GUI-based approach.

 

If you have permissions to change the source table, then you have more options. PROC SQL, for example. This would be ideal if your expression might become more complex than what you shared above.

 

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
  • 1 reply
  • 232 views
  • 2 likes
  • 2 in conversation