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?