I'm trying to use a Libname in a proc export and no matter what I do I get the
Apparent symbolic reference not resolved error> Any help greatly appreciated.
libname outy "H:\SAS Code";
PROC EXPORT DATA= WORK.CMFY_ProvSpecE_people
OUTFILE= "&outy.CMFY_ProvSpec_East_&date..csv"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
Thanks,
Brian
That's not how a libname is referenced. A libname is used to reference SAS datasets not paths, note the addition of the (\).
I think you want a MACRO variable.
%let outy = H:\SAS Code;
PROC EXPORT DATA= WORK.CMFY_ProvSpecE_people
OUTFILE= "&outy.\CMFY_ProvSpec_East_&date..csv"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
That's not how a libname is referenced. A libname is used to reference SAS datasets not paths, note the addition of the (\).
I think you want a MACRO variable.
%let outy = H:\SAS Code;
PROC EXPORT DATA= WORK.CMFY_ProvSpecE_people
OUTFILE= "&outy.\CMFY_ProvSpec_East_&date..csv"
DBMS=CSV REPLACE;
PUTNAMES=YES;
RUN;
It helps to show the entire code. Symbolic reference often referrs to the macro variables.
OUTFILE wants things in the form of an operating file system. The LIBRARY is not valid or going to be used in this case.
OUTFILE= "H:\SAS Code\CMFY_ProvSpec_East_&date..csv"
OR
%let Outy = H:\SAS Code\"; to use the way you attempted.
Also you would need the \ unless the folder's name is SAS CodeCMFY_ProvSpec_East_&date
Your program is referring to two macro variables: &OUTY and &DATE
The error message is saying that at least one of these has not been defined. You can get a list of all user-defined macro variables with a single statement:
%put _user_;
Once you see which are defined and which are not, you can handle this error. There may be additional errors after that, if PROC EXPORT detects them. But the first step is to eliminate the current error which is one (or two) of your macro variables not being defined in time.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.