Search code examples
saspromptproc-sqlenterprise-guide

How to convert SAS EG Query with Prompt Values into a proc SQL Code


I have a very basic question
I build a query in SAS-EG so that it outputs var1, YEAR and MONTH values but

YEAR and MONTH values are prompt values(A and B respectively)

It works fine when I use SAS-EG GUI but the code below does not work when I

copy paste it into a new program.

If you help me I would really appreciate.

Thanks

 %_eg_conditional_dropds(want);
 PROC SQL;
 CREATE TABLE WORK.want AS 
    SELECT t1.YEAR, 
       t1.MONTH, 
       t1.var1, 
    FROM have t1
    WHERE %_eg_WhereParam( t1.MONTH, A, EQ, TYPE=S, IS_EXPLICIT=0 ) AND  %_eg_WhereParam( t1.YEAR, B, EQ, TYPE=S, IS_EXPLICIT=0 );
 QUIT;

Solution

  • Assuming that when you "copy paste it to a new program" you are still in the EG UI, try the following.

    1. Right click on the program icon in the EG flow and choose Properties from the context menu.
    2. Select "Prompts" from the left hand menu.
    3. "Add"
    4. select the required prompts.

    Now when you run the program, you should get prompted for the Prompts.