BookmarkSubscribeRSS Feed
TMKAIG1
Fluorite | Level 6

Hi!

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.;

39        

40         options fullstimer;

41        

42         proc printto log="&path.pmbm.txt" new;

NOTE: Line generated by the macro variable "PATH".

42         ""/SASHome/saswork0/Lev1saswork/SAS_work4424000057DF_plccasam1sgn01/SAS_workC6E2000057DF_plccasam1sgn01/"pmbm.txt

             _

             22

             76

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.

43         run;


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.

Thanks!

4 REPLIES 4
TomKari
Onyx | Level 15

You didn't do anything wrong. Try running this code:

%let path=&SASWORKLOCATION.;

%put &path.;

You'll see that SAS puts double quotes around the path name; you'll need to remove them to use the macro variable.

Tom
Super User Tom
Super User

Your macro variable SASWORKLOCATION already had double quotes around it.

Try:

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 ;

TMKAIG1
Fluorite | Level 6

Hi!


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.


Tom --


%sysfunc(quote(&sasworklocation.pmbm.txt))

doesn't work, because the quotes are still in the &sasworklocation. value.


%sysfunc(quote(%sysfunc(pathname(work))/pmbm.txt))

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:


%let path=%sysfunc(dequote(&SASWORKLOCATION.));


That solved the problem.

Tom
Super User Tom
Super User

/ 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" ;

8      input;

9      put _infile_;

10   run;

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,

      Last Modified=07Jan2015:19:50:20,

      Create Time=07Jan2015:19:50:19

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2428 views
  • 6 likes
  • 3 in conversation