DATA Step, Macro, Functions and more

WARNING: Apparent symbolic reference I_28MAY17 not resolved.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

WARNING: Apparent symbolic reference I_28MAY17 not resolved.

Hello,

 

I am getting the following error message:

WARNING: Apparent symbolic reference I_28MAY17 not resolved.
WARNING: Apparent symbolic reference I_28MAY17 not resolved.
 
ERROR: Physical file does not exist, /folders/myfolders/sasuser.v94/tran.&i_28MAY17..csv.
 
When I run the following code.  

 

%macro onetime;
%local i;
%do i=1 %to 37 %by 1;

DATA temp_&i;
INFILE "/folders/myfolders/sasuser.v94/tran.&i_28MAY17..csv" DSD delimiter=',' missover firstobs=2;
informat Date Date. Credit 8.2 Debit 8.2;
FORMAT Date Smiley Very HappyATE. Credit dollar.0 Debit dollar.0;
INPUT
Account :$8.
Tran_Code :$4.
Date
Credit
Debit
Desc :$100.
;
RUN;
%end;
%mend onetime;
%onetime;

 

How do I fix the code?

thanks


Accepted Solutions
Solution
‎06-21-2017 09:32 PM
Super User
Super User
Posts: 7,060

Re: WARNING: Apparent symbolic reference I_28MAY17 not resolved.

[ Edited ]

Your program is asking for that macro variable, but you haven't defined it. I suspect that you really want to reference the macro varaible I but the way you wrote the filename you did not tell SAS that. When the macro variable name is followed immediately by characters like underscore, digits and letters that could be part of a valid macro variable name you need to add a period so that the macro processor knows where the name of the macro variable ends.  

Also does your filename really have two periods before the csv extension?

%do i=1 %to 37 %by 1;
DATA temp_&i;
  INFILE "/folders/myfolders/sasuser.v94/tran.&i._28MAY17.csv" 
    DSD delimiter=',' missover firstobs=2
  ;

 

View solution in original post


All Replies
Super User
Super User
Posts: 7,976

Re: WARNING: Apparent symbolic reference I_28MAY17 not resolved.

This line:

INFILE "/folders/myfolders/sasuser.v94/tran.&i_28MAY17..csv" DSD delimiter=',' missover firstobs=2;

                                                                                          ^

At the carat here you have put the point which means the macro variable is &i_28MAY17.  This isn't what you wanted, maybe:

INFILE "/folders/myfolders/sasuser.v94/tran.&i._28MAY17.csv" DSD delimiter=',' missover firstobs=2;

 

Per your other post however, if you read Reeza's advice you will see that you do not need macro at all, there are far simpler methodologies, I cut and paste the link for your reference:

https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-tex...

Solution
‎06-21-2017 09:32 PM
Super User
Super User
Posts: 7,060

Re: WARNING: Apparent symbolic reference I_28MAY17 not resolved.

[ Edited ]

Your program is asking for that macro variable, but you haven't defined it. I suspect that you really want to reference the macro varaible I but the way you wrote the filename you did not tell SAS that. When the macro variable name is followed immediately by characters like underscore, digits and letters that could be part of a valid macro variable name you need to add a period so that the macro processor knows where the name of the macro variable ends.  

Also does your filename really have two periods before the csv extension?

%do i=1 %to 37 %by 1;
DATA temp_&i;
  INFILE "/folders/myfolders/sasuser.v94/tran.&i._28MAY17.csv" 
    DSD delimiter=',' missover firstobs=2
  ;

 

☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 118 views
  • 1 like
  • 3 in conversation