BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can you populate a parameter dropdown list with the values in a variable?

I am trying to build a parameter that takes the values found in one of my variables and uses them as the options in the parameter's dropdown list. However, the 'Variable Name' data type in EG only lists the variable name, not the values in the variable itself.

Any thoughts? Thanks!
6 REPLIES 6
Cynthia_sas
Diamond | Level 26
Hi,
Try this:
Instead of variable name, select "String" for Data Type
and then, for data value type, select "A list of Values"

You should then see (on the left) a "Load Values" button that will let you choose a dataset and choose a variable in the dataset. On the right, you can choose either a single selection or a multiple selection. If I am going to make them pick something from a list, I ALWAYS check/select these choices:
A value is required at runtime
Prompt for value (and your list of variable values will be used)

You can decide about quoting -- I always put my own quotes, unless I'm allowing multiple values separated by a comma (as in a where clause with an IN).

For more help with setting a list of parameter values in EG, for a numeric variable or for a date value, you might consider contacting Tech Support.

cynthia
deleted_user
Not applicable
That's exactly what I was looking for! You have no idea how much time you have saved us.

Now, for one followup question. Do we need to repopulate them into the parameter manually if the values change monthly, and if so, is there a way to refresh the list through code?

Thanks again, Jaime
Cynthia_sas
Diamond | Level 26
Hi:
As far as I know, if the values can change monthly, then you need to repopulate the list to get the new values in the drop down list.
I do not know how to repopulate the EG parameter list with code. You may want to check with Tech Support.

cynthia
ChrisHemedinger
Community Manager
There is not currently a way to populate the parameter list dynamically. You'll need to redo the steps Cynthia described each time you want to update it.

The ability to present dynamic prompts is in the realm of custom tasks, which you can create using .NET. Examples are linked from http://support.sas.com/eguide.

Chris
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
deleted_user
Not applicable
Thanks for that clarification.

So, what software packages would you recommend in order to start programming custom tasks? I have never had to program in either VisualBasic or .NET.

Thanks!
ChrisHemedinger
Community Manager
If you're targeting EG 4.1, you'll need to use a package that supports .NET 1.1. That usually means Microsoft Visual Studio 2003 (not 2005, which supports only .NET 2.0).

Chris
SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2211 views
  • 0 likes
  • 3 in conversation