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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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