CALL SYSTEM Routine: UNIX

Submits an operating environment command for execution.
Category: Special
UNIX specifics: Command must evaluate to a valid UNIX command
See: CALL SYSTEM Routine in SAS Functions and CALL Routines: Reference

Syntax

CALL SYSTEM(command);

Required Argument

command
specifies any of the following:
  • a UNIX command enclosed in quotation marks
  • an expression whose value is a UNIX command
  • the name of a character variable whose value is a UNIX command

Details

The CALL SYSTEM routine issues operating system commands. The output of the command appears in the window from which you invoked SAS.
The value of the XSYNC system option affects how the CALL SYSTEM routine works.
Note: The CALL SYSTEM routine can be executed within a DATA step. However, neither the X statement nor the %SYSEXEC macro program statement is intended for use during the execution of a DATA step.
In the following example, for each record in answer.week, if the resp variable is y, the CALL SYSTEM routine will mail a message:
data _null_;
   set answer.week;
   if resp='y' then
      do;
         call system('mail mgr < $HOME/msg');
      end;
   run;