BookmarkSubscribeRSS Feed
bclark
Calcite | Level 5

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

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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

Q1983
Lapis Lazuli | Level 10

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

art297
Opal | Level 21

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


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1069 views
  • 0 likes
  • 4 in conversation