DATA Step, Macro, Functions and more

PROC EXPORT: Error in the FILENAME statement

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

PROC EXPORT: Error in the FILENAME statement

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?


Accepted Solutions
Solution
‎03-07-2018 11:08 AM
Super User
Posts: 13,358

Re: PROC EXPORT: Error in the FILENAME statement


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.

View solution in original post


All Replies
Super User
Posts: 6,642

Re: PROC EXPORT: Error in the FILENAME statement

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.

New Contributor
Posts: 3

Re: PROC EXPORT: Error in the FILENAME statement

Posted in reply to Astounding

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.

New Contributor
Posts: 3

Re: PROC EXPORT: Error in the FILENAME statement

Cinthya_sas gave the solution for this problem in this discussion: 

 

https://communities.sas.com/t5/SAS-Procedures/Unable-to-export-data-to-local-folders-PROC-EXPORT-in-...

 

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.

 

 

 

 

Solution
‎03-07-2018 11:08 AM
Super User
Posts: 13,358

Re: PROC EXPORT: Error in the FILENAME statement


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.

☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 120 views
  • 0 likes
  • 3 in conversation