Hi everybody.
I am exporting data from SAS to a file with CSV format, however I am getting the error:
"Error in the FILENAME statement."
The code that I am running is:
FILENAME EXPRT = 'd:\exp.csv' ENCODING="UTF-8";
PROC EXPORT DATA=TEXTO.SAS_TEXTO
OUTFILE = EXPRT
DBMS=TAB;
RUN;
The SAS Server is linux and my local computer is Windows 7.
Does anyone know what happening is?
@Hederson wrote:
Thanks Astouding. This equal sign really was a problem. After I removed it the code running, and now I have a new error of authorization in the SAS server.
ERROR: Insufficient authorization to access /opt/app/SASConfig/Lev1/SASApp/d:\exp.csv
I changed the FILENAME statement for the file be wrote in the SAS Server, like this:
FILENAME EXPRT TEXTO.exp.csv ENCODING="UTF-8";
TEXTO is a libname. However I got the same error message.
Do you know why SAS server is using the directory /opt/app/SASConfig... and not /opt/app/saswork... where I have write permission?
What am I doing wrong?
Thank you.
Most likely issue: you are running the code on a SERVER and the server is using a path relative to where it is currently executing as the server doesn't know where your "d:\exp.csv" would be. And you don't have permissions to create files in the SAS configuration folder. Use an fully qualified path for filename statements. If you want the file on your hard drive then you likely need IT to set up the link so the server can find it or possibly set up a shared folder both can see or export the file to the correct folder and use another task to transfer the file to your hard drive.
Your error message doesn't match the filename so other issues may arise.
Start with the piece that we know to be wrong: remove the first equal sign in the FILENAME statement. Test and see if that's enough or if more change is needed.
Thanks Astouding. This equal sign really was a problem. After I removed it the code running, and now I have a new error of authorization in the SAS server.
ERROR: Insufficient authorization to access /opt/app/SASConfig/Lev1/SASApp/d:\exp.csv
I changed the FILENAME statement for the file be wrote in the SAS Server, like this:
FILENAME EXPRT TEXTO.exp.csv ENCODING="UTF-8";
TEXTO is a libname. However I got the same error message.
Do you know why SAS server is using the directory /opt/app/SASConfig... and not /opt/app/saswork... where I have write permission?
What am I doing wrong?
Thank you.
Cinthya_sas gave the solution for this problem in this discussion:
The location in the FILENAME statement must refer an directory in the SAS Server, not in the local machine. Then, it will be like this: "/home/xxxxxxxxxx". The SAS Administrator should answer the right path of this directory.
@Hederson wrote:
Thanks Astouding. This equal sign really was a problem. After I removed it the code running, and now I have a new error of authorization in the SAS server.
ERROR: Insufficient authorization to access /opt/app/SASConfig/Lev1/SASApp/d:\exp.csv
I changed the FILENAME statement for the file be wrote in the SAS Server, like this:
FILENAME EXPRT TEXTO.exp.csv ENCODING="UTF-8";
TEXTO is a libname. However I got the same error message.
Do you know why SAS server is using the directory /opt/app/SASConfig... and not /opt/app/saswork... where I have write permission?
What am I doing wrong?
Thank you.
Most likely issue: you are running the code on a SERVER and the server is using a path relative to where it is currently executing as the server doesn't know where your "d:\exp.csv" would be. And you don't have permissions to create files in the SAS configuration folder. Use an fully qualified path for filename statements. If you want the file on your hard drive then you likely need IT to set up the link so the server can find it or possibly set up a shared folder both can see or export the file to the correct folder and use another task to transfer the file to your hard drive.
Your error message doesn't match the filename so other issues may arise.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.