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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 752 views
  • 1 like
  • 3 in conversation