Macro Error?

Accepted Solution Solved
Reply
Super Contributor
Posts: 398
Accepted Solution

Macro Error?

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

 


Accepted Solutions
Solution
‎11-01-2017 12:35 PM
Super User
Super User
Posts: 9,855

Re: Macro Error?

[ Edited ]

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


All Replies
Super User
Posts: 6,935

Re: Macro Error?

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. 

Super Contributor
Posts: 398

Re: Macro Error?

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.

Solution
‎11-01-2017 12:35 PM
Super User
Super User
Posts: 9,855

Re: Macro Error?

[ Edited ]

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

Super Contributor
Posts: 398

Re: Macro Error?

You are right, thanks.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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