2
votes

I'm using PROC EXPORT of SAS to export information in xlsx format into a shared folder in my network. When I use the servername in the path of the output file, everything works well. When I change for the IP ADDRESS of the server, I get the following error:

ERROR: Connect: The Microsoft Access database engine cannot open or write to the file '\\123.12.12.12\PUBLIC\TEST1.xlsx'. It is already opened exclusively by another user, or you need permission to view and write its data.

Here it's my code:

proc export 
data=WORK.TABLE1
DBMS=EXCEL
outfile="\\123.12.12.12\PUBLIC\TEST1.xlsx"
REPLACE;
SHEET='A';
run;

Do you know if the IP ADDRESS format is supported by PROC EXPORT? If not, it exists other method to export in SAS by using IP ADDRESS in the path of the output file? I have to use a way with IP ADDRESS as the servername is changed from time to time and I a have a bunch of scheduled SAS projets.

Thank you, Dan

1
Do you have that document open in excel?Robert Penridge
@Robert Penridge: No.DanL
You could use nbstat or nslookup host command to retrieve the name-for-addr, and use the retrieved name in your outfile. I would think changing the host name of a fixed address is more damaging than changing the address of a fixed name.Richard

1 Answers

1
votes

That error is coming from the file system. SAS is using the file system to get to whatever path you specify, so in Windows, what you have should work.

Possible Problems:

  1. Someone else has the file open.

  2. Another process has locked the file.

  3. You (the user SAS runs as) do not have write permissions to the file or directory.

Test #3 by

data _null_;
file "\\123.12.12.12\PUBLIC\TEST1.txt";
put "Hi";
run;

This will confirm you have write permissions in the directory. If SAS is running on the server, do this in the same way you call your other program.

If that is successful, then try deleting the XLSX file from Windows. If that fails, you don't have permission or someone has the file opened. You will need to debug that.

If it succeeds, then rerun your program. Hopefully it will create the file.