BookmarkSubscribeRSS Feed
George12
Fluorite | Level 6

I'm working on a report in SAS VA.

 

For the sake of simplicity, I have three measures (num_var_1, num_var_2, num_var_3), and I have a character parameter with 'Multiple values' enabled (measures_parameter).

 

I also have a List control object, which is populated with corresponding character strings for those measures (e.g. 'num_var_1', 'num_var_2', 'num_var_3'). Multiple values can be selected on this List control object. Measures_parameter is also attached to this List control object.

 

Essentially, I want to create a new calculated item (num_var_total), which is the SUM of any/all of the three measures which are selected in the List control object. I have managed to achieve this with the following code:

(IF ( 'num_var_1' IN 'measures_paremeter'p )
RETURN 'num_var_1'n
ELSE 0 ) 
+
(IF ( 'num_var_2' IN 'measures_paremeter'p )
RETURN 'num_var_2'n
ELSE 0 ) 
+
(IF ( 'num_var_3' IN 'measures_paremeter'p )
RETURN 'num_var_3'n
ELSE 0 ) 


However, in practice, I actually have 30+ different measures, and these measures will be regularly changed (with new measures added or old ones removed).

 

So, the question: Is there any way that this code can be amended so that it will be more update-friendly? More specifically, is there any way that the code can be amended so that it will automatically recognise changes to the measures, so that I don't have to write code for 30+ individual measures and rewrite this code whenever the measures are updated?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 0 replies
  • 599 views
  • 0 likes
  • 1 in conversation