SASUnit Examples  Version 1.5.0
windows/_mkdir.sas
Go to the documentation of this file.
1 
23 %macro _mkdir (dir
24  );
25 
26  %local xwait xsync xmin logfile;
27  %let xwait=%sysfunc(getoption(xwait));
28  %let xsync=%sysfunc(getoption(xsync));
29  %let xmin =%sysfunc(getoption(xmin));
30 
31  options noxwait xsync xmin;
32 
33  %let logfile=%sysfunc(pathname(work))\___mkdir.txt;
34  %SYSEXEC(md "&dir" > "&logfile" 2>&1);
35 
36  %if &g_verbose. %then %do;
37  %put ======== OS Command Start ========;
38 
39  /* Evaluate sysexec´s return code */
40  %if &sysrc. = 0 %then %put &g_note.(SASUNIT): Sysrc : 0 -> SYSEXEC SUCCESSFUL;
41  %else %put &g_error.(SASUNIT): Sysrc : &sysrc -> An Error occured;
42 
43  /* put sysexec command to log*/
44  %put &g_note.(SASUNIT): SYSEXEC COMMAND IS: md "&dir" > "&logfile";
45 
46  /* write &logfile to the log*/
47  data _null_;
48  infile "&logfile" truncover lrecl=512;
49  input line $512.;
50  putlog line;
51  run;
52  %put ======== OS Command End ========;
53  %end;
54 
55  options &xwait &xsync &xmin;
56 
57 %mend _mkdir;
58