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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 525 views
  • 0 likes
  • 1 in conversation