BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

See the log below. Can someone tell me how to call this macro variable in infile statement? Because I could not resolve the macro variable as per the log below.

1          %let filedate=%sysfunc(putn("&sysdate9"d-1,yymmdd10.));

2          %put &filedate;

2015-08-23

ERROR: Physical file does not exist,

       /usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_"&filedate"_tmptcmsaslva2_*.log.

Note: I copy\paste only the required log and NOT everything.

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I can't tell from the code you have given, how the infile statement looks.  It should look like:

infile "abc\def\&FILEDATE._tmp.csv";

However, why do you need the macro variable at all?

infile "abc\def\%sysfunc(putn("&sysdate9"d-1,yymmdd10.))_tmp.csv";

PaigeMiller
Diamond | Level 26

Your error message could be interpreted as not a macro variable error, it could mean your macro variable has worked properly and your infile statement points to a file that doesn't exist.

It would help if you showed us the INFILE statement.

--
Paige Miller
Tom
Super User Tom
Super User

Looks like you used single quotes in the INFILE statement, so the macro variable was not expanded. Also I doubt the you want the double quote characters embedded into the filename.

infile "/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_&filedate._tmptcmsaslva2_*.log" ...


Quentin
Super User

Yes, please show your INFILE statement.

If that is really the error message you are getting, I would guess maybe your infile statement looks something like:

  infile '/usr/sas/.../SASApp_STPServer_"&filedate"_tmptcmsaslva1_*.log';

The single quotes would keep &filedate from resolving.   And you don't want double quotes in the middle of your file name.

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 950 views
  • 0 likes
  • 5 in conversation