Hi,
Running program to set a location (output) up as macro variable then proc export to that location / macro variable.
Unfortunately, SAS gives the below errors. Any ideas appreciated. P.S. I'm using SAS Studio.
Ok, you didn't follow my advice to remove the double-quotes at the start and end of %let outpath=
Now, let me explain how macro variables work. When you run the code, the macro variable itself is replaced by its value, and the result must be legal valid working SAS code. You do not have legal valid working SAS code here.
Your line of code
outfile="&outpath"
after replacement, this is your code
outfile=""S:/workshop/epg1v2/output""
Can you see why this isn't valid code without macro variables? What would you have to do to make it valid code, without macro variables?
I don't think you want 3 double-quotes in &OUTPATH. In fact, I also don't think you want a double-quote at the start of &OUTPATH and you don't want a double-quote at the end of &OUTPUT either. So remove all three double quotes, fix that and see if it works.
If not, show us the ENTIRE log for this PROC IMPORT (not selected portions of the log, but ALL of the log for PROC IMPORT)
For your future benefit, never say "SAS doesn't like it" and provide no other information. We can't help you.
ALWAYS show us the log when your code isn't working. Or if the code works but the output is wrong, show us the output and what you expect and explain. Then we can help you.
Apologies, that was a typo when I re-typed the program into the window. I have updated original message with a screenshot of program + error messages.
Hi, so I did ask to see the ENTIRE log for PROC EXPORT, not just whatever parts you select.
I would also like to see the line where you define the macro variable %let outpath=
Ok, you didn't follow my advice to remove the double-quotes at the start and end of %let outpath=
Now, let me explain how macro variables work. When you run the code, the macro variable itself is replaced by its value, and the result must be legal valid working SAS code. You do not have legal valid working SAS code here.
Your line of code
outfile="&outpath"
after replacement, this is your code
outfile=""S:/workshop/epg1v2/output""
Can you see why this isn't valid code without macro variables? What would you have to do to make it valid code, without macro variables?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.
Find more tutorials on the SAS Users YouTube channel.