Search notes:

SAS macro: shellCmd

tq84_shellCmd can be used to execute to execute a shell command and print its result in the log file.
%macro tq84_shellCmd(cmd);
  filename tq84_sh pipe "&cmd";
  data _null_;
    infile tq84_sh truncover;
    input  line $256.;
    put    line;
  run;
%mend  tq84_shellCmd;
Github repository about-SAS, path: /macros/shellCmd.sas

Example

The following example uses tq84_opt to determine the work directory and then lists the directories contents with ls -ltr (ordering from oldest to newest):
%macro tq84_shellCmd(cmd);
  filename tq84_sh pipe "&cmd";
  data _null_;
    infile tq84_sh truncover;
    input  line $256.;
    put    line;
  run;
%mend  tq84_shellCmd;
Github repository about-SAS, path: /macros/shellCmd.sas

See also

filename pipe
The systask statement might be better suited for such a task.
macros

Index