Apparent symbolic reference not resolved

Reply
Occasional Learner
Posts: 1

Apparent symbolic reference not resolved

When  I run the below code on SAS enterprise Guide 5.2, I am able to convert all the SAS datasets to Text files. But when I run the same code on SAS 9.2 it throws me below error: 

 

Error : "OUTPUT" is not a valid name

warning : " Apparent symbolic reference B not resolved"

ERROR : invalid data set name OUTPUT 

warning : " Apparent symbolic reference B not resolved"

 

Code :

 

libname OUTPUT 'P:\sample\SAS_check';

proc  sql ;

select memname into :b1 -: b3 from

dictionary.tables where libname = 'OUTPUT';

quit;

%macro txt;

%do i=1 %TO 3;

proc export data=OUTPUT.&&b&i

outfile="P:\sourcing\SAS_check\&&b&i...txt" dbms=tab replace; run;

%end;

%mend txt;

%txt

 

IF I want to implement the above code in SAS 9.2 what all changes do I need to make from the above code?

 

Thanks

Trusted Advisor
Posts: 1,137

Re: Apparent symbolic reference not resolved

Posted in reply to techie123

Please try the below code, i just included an additional dot after output libname in proc export

 

libname OUTPUT 'P:\sample\SAS_check';

proc  sql ;

select memname into :b1 -: b3 from

dictionary.tables where libname = 'OUTPUT';

quit;

%macro txt;

%do i=1 %TO 3;

proc export data=OUTPUT..&&b&i

outfile="P:\sourcing\SAS_check\&&b&i...txt" dbms=tab replace; run;

%end;

%mend txt;

%txt

Thanks,
Jag
Super User
Posts: 11,343

Re: Apparent symbolic reference not resolved

Posted in reply to techie123

Do you actually have 3 data sets in the OUTPUT library? If not &b3 does not resolve.

 

Run your code with :

options mprint symbolgen;

%txt

 

 

And see if the log shows you an issue with one or more of your &b variables.

 

 

Super User
Super User
Posts: 7,042

Re: Apparent symbolic reference not resolved

[ Edited ]
Posted in reply to techie123

I don't think using an old version of SAS will impact this program. Most likely your issue is that you are running on different data and so the program runs wrong.  Make the program more flexible so that it adapts to the data that is available.

 

Instead of hard coding the upperbound let SAS count for you.  This program should work fine with SAS9.2 (or even older).

 

%macro txt(libref,outdir=P:\sourcing\SAS_check);
%local i;
proc sql noprint ;
  select memname into :b1 - :b999999
    from dictionary.tables
    where libname = %upcase("&libref")
  ;
quit;
%do i=1 %to &sqlobs;
proc export data=&libref..&&b&i dbms=tab 
  outfile="&outdir\&&b&i...txt" replace
; 
run;
%end;
%mend txt;

libname OUTPUT 'P:\sample\SAS_check';
%txt(output);
Ask a Question
Discussion stats
  • 3 replies
  • 243 views
  • 0 likes
  • 4 in conversation