Desktop productivity for business analysts and programmers

Parameter values

Not applicable
Posts: 0

Parameter values

I am using 2 parameters. One is for the low range the other is for the high range. Both are drop downs with a list of values. I want the user to be able to only put in the low value if they only want 1 value and not a range. In that case I need the 2nd parameter to = the first parmeter.

Any idea on how to do this?? I have tried multiple things and nothing seems to work. Like making the default of parmeter2 parameter1. Probably just not doing something quite right.

example.... parm1 ...selects 0012
parm 2 selects 0014 then the result is everthing from 0012 to 0014

example2 parm1 selects 0012
parm2 nothing selected then only want 0012 results.
Not applicable
Posts: 0

Re: Parameter values

Posted in reply to deleted_user
Hi, Cheri,

Here is a suggestion (please keep in mind the pseudo code in my reply is not the exact code you will need):

In a data step:

If parm2 eq
then parm2 = parm1;

The data step must have the run; command as its last line.

I'm assuming you will be using a Proc SQL later, so you would then, in Proc Sql, have something like the following:

Proc Sql;
CREATE TABLE YourTable AS SELECT field1, field2
FROM YourOtherTable AS CallItWhatever
WHERE YourOtherTable.field1 BETWEEN "&parm1" and "&parm2";

Don't might need to include logic in your data step that checks to make sure the second parm is equal to or larger than the first parm, but not smaller than the first parm.

Hope this helps. Also, in these forums, there is a lady from SAS, by the name of Cynthia, who has been a tremendous help to me. If you can catch her attention, she is wonderful on replying and on helping!
Super Contributor
Posts: 260

Re: Parameter values

Posted in reply to deleted_user
Sticking to the EG logic, you can define your second parameter (let's say it's called MAX and the first one MIN) with &MIN as the default value.
In your condition, specify :
&min AND %UNQUOTE(&max)

By default, EG prevents using more than one step of macro-variable (parameters) resolutions. So the &max --> &min --> value is forbidden by default : that's why default values for parameters are enclosed in %NRSTR() function calls at the beginning of the code.
Using the %UNQUOTE function will cancel the effect of the %NRSTR protection and allow your definition of &max being equal to &min.

And any user value overriding the &min value for MAX will also work out fine (at least on the example I've used to test).

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation