01-07-2015 05:11 PM
I am adapting a popular benchmark program that was written for base SAS in Windows to run in Enterprise Guide. The program does PROC PRINTTO at the top so that it can read the log file at the end and parse out running times. It was written to place the log file on the C: drive, but now EG is running this in a server environment, so I attempted to change the path from the C: drive to the &SASWORKLOCATION. value. It didn't work. Here is the error message:
37 %*let path=c:\temp\;
38 %let path=&SASWORKLOCATION.;
40 options fullstimer;
42 proc printto log="&path.pmbm.txt" new;
NOTE: Line generated by the macro variable "PATH".
ERROR 22-322: Syntax error, expecting one of the following: ;, FILE, LABEL, LOG, NAME, NEW, PRINT, UNIT.
ERROR 76-322: Syntax error, statement will be ignored.
Can anyone please tell me what I did wrong? And how to correct this so that the file gets written to the SASWORKLOCATION? I don't want to modify anything else about the benchmark program (such as the choice of PROC PRINTTO) if I don't have to.
01-07-2015 05:33 PM
You didn't do anything wrong. Try running this code:
You'll see that SAS puts double quotes around the path name; you'll need to remove them to use the macro variable.
01-07-2015 05:35 PM
Your macro variable SASWORKLOCATION already had double quotes around it.
proc printto log=%sysfunc(quote(&sasworklocation.pmbm.txt)) new ;
Or just ask SAS where the work location is:
proc printto log =%sysfunc(quote(%sysfunc(pathname(work))/pmbm.txt)) new ;
01-07-2015 06:58 PM
Thank you to Tom and TomKari for the helpful responses. The surrounding quotes in the SASWORKLOCATION value were the problem. The SASWORKLOCATION variable doesn't seem to exist in base SAS 9.3. I found it by doing %put _ALL_ in EG 6.1, and I didn't realize that the quotes I saw in the log were actually part of the macro variable value.
doesn't work, because the quotes are still in the &sasworklocation. value.
would work, but then you have to add in the "/" character, which seems OS specific; it works in UNIX, but would it also work in Windows?
I posted this issue on SAS-L and someone suggested using:
That solved the problem.
01-07-2015 07:55 PM
/ should work in Windows. SAS should handle converting to the appropriate value for your OS.
6 data _null_;
7 infile "%sysfunc(pathname(work))/&sysscp..log" ;
9 put _infile_;
NOTE: The infile "C:\SAS Temporary Files\_TD5256/WIN.log" is:
Filename=C:\SAS Temporary Files\_TD5256\WIN.log,
RECFM=V,LRECL=32767,File Size (bytes)=468,