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!

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!

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.

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