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

Hi all:

 

I have a macro code below.  I found log view showed one error while I ran the codes.  Please let me know how to fix it.  Thanks.

 

options mprint symbolgen mlogic;
%let Year=2014;
%let YY=14;
%let Table1=B02;
%let Table2=B19;
.
.
.
.
%let Table12=S408;
%let importfolder=pathway\All_US_&year.;

%macro import;

 %do i  = 1 %to 12;

 PROC IMPORT OUT=ACS_&YY._5YR_&&TABLE&i 
            DATAFILE= "&importfolder.\ACS_&YY._5YR_&&TABLE&i._with_ann.csv" 
            DBMS=CSV REPLACE;
     		GETNAMES=YES;
     		DATAROW=2; 
		GUESSINGROWS=MAX;
RUN;
 
%end; 

%mend;

%import;

 

The error message is shown below.

MLOGIC(IMPORT): Beginning execution.

MLOGIC(IMPORT): %DO loop beginning; index variable I; start value is 1; stop value is 2; by

value is 1.

SYMBOLGEN: Macro variable YY resolves to 14

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 1

SYMBOLGEN: Macro variable TABLE1 resolves to B02001

SYMBOLGEN: Macro variable IMPORTFOLDER resolves to

Pathway\All_US_2014

SYMBOLGEN: Macro variable YY resolves to 14

SYMBOLGEN: && resolves to &.

SYMBOLGEN: Macro variable I resolves to 1

WARNING: Apparent symbolic reference TABLE1_WITH_ANN not resolved.

MPRINT(IMPORT): PROC IMPORT OUT=ACS_14_5YR_B02001 DATAFILE=

"Pathway\All_US_2014\ACS_14_5YR_&TABLE1_with_ann.csv" DBMS=CSV REPLACE;

MPRINT(IMPORT): ADLM;

MPRINT(IMPORT): GETNAMES=YES;

MPRINT(IMPORT): DATAROW=2;

MPRINT(IMPORT): GUESSINGROWS=MAX;

MPRINT(IMPORT): RUN;

ERROR: Physical file does not exist, pathway\All_US_2014\ACS_14_5YR_&TABLE1_with_ann.csv.

ERROR: Import unsuccessful. See SAS Log for details.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

This is the fix

 

DATAFILE= "&importfolder.\ACS_&YY._5YR_&&TABLE&i.._with_ann.csv" 

You need two dots after &&TABLE&I in order to indicate the end of the macro variable name and the beginning of extra non-macro text. 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

This is the fix

 

DATAFILE= "&importfolder.\ACS_&YY._5YR_&&TABLE&i.._with_ann.csv" 

You need two dots after &&TABLE&I in order to indicate the end of the macro variable name and the beginning of extra non-macro text. 

--
Paige Miller
ybz12003
Rhodochrosite | Level 12

Thanks much!  I got it worked!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1302 views
  • 0 likes
  • 2 in conversation