Desktop productivity for business analysts and programmers

Populating a parameter dropdown list with a variable

Reply
N/A
Posts: 0

Populating a parameter dropdown list with a variable

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!
SAS Super FREQ
Posts: 8,814

Re: Populating a parameter dropdown list with a variable

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
N/A
Posts: 0

Re: Populating a parameter dropdown list with a variable

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
SAS Super FREQ
Posts: 8,814

Re: Populating a parameter dropdown list with a variable

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
Community Manager
Posts: 2,882

Re: Populating a parameter dropdown list with a variable

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
N/A
Posts: 0

Re: Populating a parameter dropdown list with a variable

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!
Community Manager
Posts: 2,882

Re: Populating a parameter dropdown list with a variable

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
Ask a Question
Discussion stats
  • 6 replies
  • 157 views
  • 0 likes
  • 3 in conversation