DATA Step, Macro, Functions and more

Program Code - Multiple Value Prompt

Reply
N/A
Posts: 1

Program Code - Multiple Value Prompt

I am attempting to create a multiple value text prompt with user input values.

My code so far is:

proc report data=FS_STG.STG_PROMOTION nowd;

    column PROD_ID PROMO_EFF_DATE cv1 PROMO_END_DATE cv2 VEHICLE_NM PROMO_NAME FOCUS_PAGE PROMO_PRICE,                MEAN=PROMO_PRICE_MEAN RETAIL_PRICE, MEAN=RETAIL_PRICE_MEAN PROMO_NO, MODE=PROMO_NO_MODE;

    WHERE PROD_ID = "&prod_id" ;

    define PROD_ID / group 'PROD_ID' missing;

    compute PROD_ID;

        if PROD_ID ne ' ' then hold1=PROD_ID;

        if PROD_ID eq ' ' then PROD_ID=hold1;

    endcomp;

The log displays:

%LET PROD_ID1 = 5550123;

%LET PROD_ID0 = 2;

%LET PROD_ID_count = 2;

%LET PROD_ID2 = 1100255;

%LET PROD_ID = 5550123;

With my current code the results only display PROD_ID 5550123. What do I need to change to have it also recognize PROD_ID2, etc (for the number of values the user inputs)?

Thanks

SAS Super FREQ
Posts: 8,864

Re: Program Code - Multiple Value Prompt

Hi:

  You will at least have to change your WHERE statement to something like:

WHERE PROD_ID in ("&PROD_ID1" "&PROD_ID2" "&PROD_ID3" "&PROD_ID4");

  But depending on how you want your program to operate, you may have to "macro-ize" your code with a %DO loop to build the exact WHERE statement by looping from 1 to &PROD_ID_count and using macro techniques in a macro program. &PROD_ID will always show the first selection that is made in a multi-value selection prompt, so if you need the other values, it is up to you to use the numbered macro variables that are sent by the prompting interface.

cynthia

Frequent Contributor
Posts: 141

Re: Program Code - Multiple Value Prompt

Posted in reply to Cynthia_sas

Can you tell me why I am getting error messages saying I cannot post more than once every 60 seconds.  I cannot locate anyone in troubleshooting

PROC Star
Posts: 7,471

Re: Program Code - Multiple Value Prompt

Q1983: The Communities Admin posted the following a week or so ago:

Your discussions will not go through moderation. However, we are fine tuning our spam filter and post-rate timing to help curb this recent abuse. If you experience any issues with the post-rate change (prevents multiple messages from being posted in a certain time frame - such as within 60 seconds) ... let me know


Ask a Question
Discussion stats
  • 3 replies
  • 333 views
  • 0 likes
  • 4 in conversation