Previous Page | Next Page

Automatic Macro Variables

SYSCMD Automatic Macro Variable



Contains the last unrecognized command from the command line of a macro window.
Type: Automatic macro variable (read and write)

Details
Example
Processing Commands Entered In a Macro Window

Details

The value of SYSCMD is null before each execution of a %DISPLAY statement. If you enter a word or phrase on the command line of a macro window and the windowing environment does not recognize the command, SYSCMD receives that word or phrase as its value. This method is the only way to change the value of SYSCMD, which otherwise is a read-only variable. Use SYSCMD to enter values on the command line that work like user-created windowing commands.


Example


Example 1: Processing Commands Entered In a Macro Window

The macro definition START creates a window in which you can use the command line to enter any windowing command. If you type an invalid command, a message informs you that the command is not recognized. When you type QUIT on the command line, the window closes and the macro terminates.

%macro start;
  %window start
     #5  @28 'Welcome to the SAS System'
     #10  @28 'Type QUIT to exit';
  %let exit = 0;
  %do %until (&exit=1);
     %display start;
     %if &syscmd ne %then %do;
        %if %upcase(&syscmd)=QUIT %then %let exit=1;
        %else %let sysmsg=&syscmd not recognized;
     %end;
  %end;
%mend start;

Previous Page | Next Page | Top of Page