BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hederson
Calcite | Level 5

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?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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

4 REPLIES 4
Astounding
PROC Star

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.

Hederson
Calcite | Level 5

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.

Hederson
Calcite | Level 5

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.

 

 

 

 

ballardw
Super User

@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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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