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 Employee

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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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