51 users online | 51 Guests and 0 Registered

Can I get SAS to create pop-up message boxes in Windows?


Using Display Manager commands allow you to create pop-up boxes which enable you to issue bespoke messages to the user.

Create a 'utility' macro program which will be used to generate the message box:

%macro msgbox(msg) ;
  %local sq ;
  %let msg = %sysfunc(compress(&msg,%str(%'%"))) ;
  %let sq = %bquote(%sysfunc(byte(39))) ;
  dm "postmessage &sq.&msg.&sq." ;
%mend msgbox ;

The first %LET statement removes any quotation marks form the submitted message as both will be used in the Display Manager command to be submitted.  The second %LET generates a macro-quoted single quotation mark which is then placed before and after the message to be submitted.

The macro program can then be called to create interactive messages:

%msgbox(Your code has run. Click OK to continue.)

To better see this in action use the macro to generate messages at the beginning and end of a program:

%macro biglong ;
  %msgbox(This code runs for a long time. Do not issue any commands until you see the Code Completed message.)
  %do i = 1 %to 500 ;
    putlog 'Nothing to see here...' ;
    dm 'cle log' ;
  %end ;
  %msgbox(Code completed successfully.)
%mend biglong ;

%biglong
Author:
Alan D Rudland
Revision:
1.2
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.