BookmarkSubscribeRSS Feed



I am working with a client and I have requirement as decsribed below


1. There is list of variables in the drop down list which is around 100 variables. Users will select one of the variable from this list.

2. There is a graph and list table which is populate the values of that variable. variable which is select by user in the drop down list.


I can easily do this by using a parameter in the list table and create calculated field using that parameter. This involves if else condition. Problem is that I have 100 of variable and list will keep on increasing. I can not have so many if else condition.  And if new variable is added because it will be not part of nested if else I will have to modiy that everytime. This is not desirable in the case of client I am working.  


Any solution will be helpful.


If  I am EG to create this report I can use a macro variable using prompt option and user can select the desired variable from that prompt list. Lets say that macro variable is Selected_Variable. lets assume user wants to see mean of Revenue/Cost/profit


. I will write the following program


Proc Means data=dataset;

var &Selected_Variable;



Second example


Data test;

set dataset;






&Selected_Variable this will resolve to variable Revenue if user selects Revenue in the prompt. Likewise for all other cases.


In VA if create a new calculated field and assign to that parameter. It treats as character and new field will have the value of parameter. This not having the value of parameter varibales value.


Any suggestion how to implement this. Please Please.....

SAS Employee

Hello lokendra_devangan_corecompete_com,

Have you tried using parameters to create cascading prompts? By using cascading prompts, it will lessen the number of variables. Please reference the link attached below which will go into more detail about cascading prompts. Please notify me if you have any more questions regarding this issue.



Meredith Bailey 





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
  • 1 reply
  • 1 like
  • 2 in conversation