BookmarkSubscribeRSS Feed
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?



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
  • 0 replies
  • 1 in conversation