BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello:

 

I wrote the macro codes below.  I found something is wrong when I use "importpath" macro.  Could someone help?  Thanks.

 

%let sheetname=crowding2009;

%let importpath=\\abc.org\project\ACS\CA\2009

filename in "&importpath..\&sheetname..csv";

 

data &sheetname;

infile in MISSOVER DSD firstobs=3;

input

GEO_id $

GEO_id2 $

GEO_display_label $

HD01_VD01 $

HD02_VD01 $;

run;

 

The log shows below.

81 options mprint symbolgen mlogic;

82 %let sheetname=crowding2009;

83 %let importpath=\\abc.org\project\ACS\CA\2009

84 filename in "&importpath..\&sheetname..csv";

SYMBOLGEN: Macro variable IMPORTPATH resolves to \\abc.org\project\ACS\CA\2009 filename in "\crowding2009.csv"

SYMBOLGEN: Macro variable SHEETNAME resolves to crowding2009

85

SYMBOLGEN: Macro variable SHEETNAME resolves to crowding2009

ERROR: No logical assign for filename IN.

 

However the codes works below.   So I am confused that what went wrong for the one above.

options mprint symbolgen mlogic;

%let sheetname=crowding2009;

filename in "\\abc.org\project\ACS\CA\2009\&sheetname..csv";

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

In your original text, your code is innacurate:

83 %let importpath=\\abc.org\project\ACS\CA\2009

84 filename in "&importpath..\&sheetname..csv";

Note that there is a missing semicolon after 2009

View solution in original post

4 REPLIES 4
Astounding
PROC Star

Your FILENAME statement has two dots after &IMPORTPATH, but there should only be one.

 

Most of the time, the reason to use two dots is because the second dot should become text, and should be a character within the program. 

ybz12003
Rhodochrosite | Level 12

When I put one dot, it didn't work either.  Then I put two dots.

 

184 filename in "&importpath.\&sheetname..csv";

WARNING: Apparent symbolic reference IMPORTPATH not resolved.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

In your original text, your code is innacurate:

83 %let importpath=\\abc.org\project\ACS\CA\2009

84 filename in "&importpath..\&sheetname..csv";

Note that there is a missing semicolon after 2009

ybz12003
Rhodochrosite | Level 12

You are right, thanks.

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
  • 498 views
  • 1 like
  • 3 in conversation