Return to Archive

SAS Tip of the Month
September 2003

Occasionally SAS will not action a Windows operating system command when using the SYSTEM, CALL SYSTEM, X or macro equivalent statements. In order to circumvent this SAS suggests creating a DOS .BAT file with that command then having SAS call the .BAT file. The following example demonstrates the fix where what the program is asking for a list of .TXT files in a directory which will later be read it:

   rc=SYSTEM("DIR "||dirloc||"\*.txt /b>||"dirlist");  	   

would be rewritten as

   rc=SYSTEM("DIRLSTX dirloc dirlist");  	   

with the accompanying DIRLSTX.BAT file containing the text

   DIR %1\*.txt /b>%2  	   

In the example dirloc is the directory location of the files that are of interest, and dirlist is the output file containing the list of .TXT files it found. From what I have read SAS has fixed this problem is the latest SAS version 9 release.

________________________________
Updated September 13, 2003