BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

Hello experts,

 

Please, I want to send a popup boxe message, if the length of macro-variable more than a fixed lengths.

 

%let use_name=Bob; /* Max length of user_name  must be 15 */

%let user_id=8562;   /*  Max length of user_id  must be 4  */

 

 

%macro check ;

%if   (%length(&use_name)<16 &  %length(&use_id)<5) %then %do;

%treatment;

%end;

%else %do;

 

/*send a popup boxe message to the user */

%end;

 

%mend check;

%check;

 

 

 

 

 

 

 

%mend check;

 

 

8 REPLIES 8
Cynthia_sas
SAS Super FREQ

Hi:

  You could investigate %WINDOW and %DISPLAY, but they might have limited use depending on your configuration and how you are using SAS.

 

  If you are using the BI Platform and stored processes, then you could use the prompting framework to prompt and validate input from users.

 

  As you can see from the documentation example, http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n0ojc9rtfrzvbdn16... the %WINDOW and %DISPLAY don't work in EG or SAS Studio.

try_window_display.png

 

  EG and SAS Studio both have other ways to collect input from users. (EG has the prompting framework and SAS Studio allows you to generate custom tasks.)

 

cynthia

LineMoon
Lapis Lazuli | Level 10

@Cynthia_sas : Thank you for your answer.

As you said, I have tried before  %WINDOW and %DISPLAY, but It does not work, because I work in EG and SAS 9.2.

So, please I need more information about the "prompting framework for EG and SAS 9.2"  ? or any simple idea without framework ?

 

 

Cynthia_sas
SAS Super FREQ
Hi, These papers from 2010 might be useful:
http://support.sas.com/resources/papers/proceedings10/036-2010.pdf
http://support.sas.com/resources/papers/proceedings10/041-2010.pdf

If you do NOT have the capability to create Stored Processes, then you won't be able to do everything, but the basic prompting framework is there in EG 4.2 to use.

cynthia
LineMoon
Lapis Lazuli | Level 10

@Cynthia_sas : Thank you, that's very kind from you .

SASuserlot
Barite | Level 11

Hi cynthia,

I am trying to use your code in SAS 9.4, I am getting the following error in the log. Can you please help how to generate pop msg box.

thank you.

1128  %window welcome color=white
1129      #5 @28 'Welcome to SAS.' attr=highlight
1130      Color=green
1131      #7 @15
1132      'You are executing release &sysver on &sysday, &sysdate...'
1133      #12 @29'Press Enter to Continue'
1134  %display welcome;
ERROR: Open code statement recursion detected.
ERROR: Open code statement recursion detected.

Tom
Super User Tom
Super User

You are missing a semi-colon to end the %WINDOW statement.

SASuserlot
Barite | Level 11
Worked thanks
Cynthia_sas
SAS Super FREQ

Hi:

  When I try the code in SAS 9.4, it works for me.

Cynthia_sas_0-1632417841900.png

 

 

  Pay close attention to the code I originally posted. In resolving macro variable references like &sysver or &sysdate, single quotes and double quotes make a HUGH difference. So do semi-colons to end statements.

 

  If you continue to have issues with your %WINDOW attempts, your best resource is to work with SAS Tech Support.

 

Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2849 views
  • 5 likes
  • 4 in conversation