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;
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.
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
@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 : Thank you, that's very kind from you .
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.
You are missing a semi-colon to end the %WINDOW statement.
Hi:
When I try the code in SAS 9.4, it works for me.
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
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!
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.
Ready to level-up your skills? Choose your own adventure.