The
macro DELFILE uses the value of SYSSCP to determine the platform that
is running SAS and deletes a TMP file. FILEREF is a macro parameter
that contains a filename. Because the filename is host-specific, making
it a macro parameter enables the macro to use whatever filename syntax
is necessary for the host environment.
%macro delfile(fileref);
/* Unix */
%if &sysscp=HP 800 or &sysscp=HP 300 %then %do;
X “rm &fileref..TMP”;
%end;
/* DOS-LIKE platforms */
%else %if &sysscp=OS2 or &sysscp=WIN %then %do;
X “DEL &fileref..TMP”;
%end;
/* CMS */
%else %if &sysscp=CMS %then %do;
X “ERASE &fileref TMP A”;
%end;
%mend delfile;
Here is a call to the
macro DELFILE in a PC environment that deletes a file named C:\SAS\SASUSER\DOC1.TMP:
%delfile(c:\sas\sasuser\doc1)
In this program, note
the use of the portable %SYSEXEC statement to carry out the host-specific
operating system commands.
Now, suppose you know
your macro application is going to run on some version of Microsoft
Windows. The SYSSCPL automatic macro variable provides information
about the name of the host environment, similar to the SYSSCP automatic
macro variable. However, SYSSCPL provides more information and enables
you to further tailor your macro code.