Desktop productivity for business analysts and programmers

Exporting to shared drive from SAS Server

Reply
N/A
Posts: 0

Exporting to shared drive from SAS Server

Hi,

We connect to DB2 through our SAS Server and would like to build into our program an export to our local Shared drive however when we do that the path of the file to output to is appended to the server and we get a permissions error:-

/*Generic libname assign ----------------------*/
%let ennn=653;
%let int=D;
%inc "/users/ewrk&ennn/autoexec2.sas";

/*%inc '/users/ewrk653/sdc_setup.sas';*/

/*Create table------------------------------------------------*/
/*--Build table/file name--*/
%let runDate = %sysfunc(compress(&TCUR_DTE,'-'));
%let TableName = TABLE1;/*--Set table name here--*/
%let FileName = &TableName&runDate;
PROC SQL;
CONNECT TO DB2(database=&db2dbdft CONNECTION=GLOBAL);
CREATE TABLE WORK.&TableName AS
SELECT *
FROM CONNECTION TO DB2(

SELECT * FROM SCHEMA.TABLE

FOR READ ONLY
WITH UR

);
%PUT SQLXMSG=&SQLXMSG;
%PUT SQLXRC=&SQLXRC;
DISCONNECT FROM DB2;
quit;
run;
PROC EXPORT DATA= WORK.&TableName
OUTFILE= "S:\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt"
DBMS=TAB REPLACE;
RUN;

-----------------------------------------------------------------------------------
ERROR: Insufficient authorization to access
/sas/SAS_9.2/EntBIServer/Lev1/SASApp/S:\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt.
-----------------------------------------------------------------------------------
In this example the file we are trying to export to is 'S:\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt'

How can we pick up the data from the Server then export it to our shared drive?

Any help would be much appreciated.

Thanks Brad.
Super Contributor
Posts: 356

Re: Exporting to shared drive from SAS Server

Are you using EG to connect to the SAS server or Base SAS?

That aside looking at your error...

ERROR: Insufficient authorization to access
/sas/SAS_9.2/EntBIServer/Lev1/SASApp/S:\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt.

It has concatinated your default path with the path you have tried to define. Is "S" drive known on the SAS server ? I suspect not. Try a UNC path ie

\\ComputerName\ShareName\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt.

Barry Message was edited by: twocanbazza
N/A
Posts: 0

Re: Exporting to shared drive from SAS Server

Thanks Barry.

We are using EG. I like your thinking, that makes sense. I have tried that but still seem to be having the same problem

ERROR: Physical file does not exist,
/sas/SAS_9.2/EntBIServer/Lev1/SASApp/\\SKPEUCH101\SharedData\CH\Fin\SYSTEMS\DI\Systems\SAS_EBI\Exports\OUTFILE.txt.

Don't seem to be able to divorce the output path from the Server??
Super Contributor
Posts: 356

Re: Exporting to shared drive from SAS Server

Hmmm.

Is the export code generated by EG or did you write it in a code blob?

I think I have seen another thread like this somewhere in these forums but not sure what the outcome was.

Barry
Trusted Advisor
Posts: 1,059

Re: Exporting to shared drive from SAS Server

I'm pretty sure that this is happening because in your EG session you're running this code on a unix server. Because of that, unix isn't recognizing either the S:\ or the \\SKPEUCH101 notation as the start of a directory structure, and is trying to append the name you provide to the default directory that SAS starts in.

Some options:
- Submit the code to a Windows server that can access both DB2 and your \\SKPEUCH101 server;
- Run it on your local PC, if it can do both of the above (will probably be slow);
- If you're using a unix/Windows facility to mount Windows drives on your unix server, changing the UNC format from Windows to unix should work;
- Save the dataset to an acceptable location on your unix server, and FTP it over to your Windows server.

Tom
N/A
Posts: 0

Re: Exporting to shared drive from SAS Server

Thanks Tom,

Yes that seems to be the issue, I'm probably being over optimistic to think it would be straight forward. What would the Unix UNC format look like, that sounds like the best option?

Many thanks
Super Contributor
Posts: 356

Re: Exporting to shared drive from SAS Server

I think Tom is on the right track so will leave you two to it.

Hopefully works

Barry
N/A
Posts: 0

Re: Exporting to shared drive from SAS Server

Thanks for your help anyway Barry Message was edited by: BradB
Trusted Advisor
Posts: 1,059

Re: Exporting to shared drive from SAS Server

That's really hard to say. You'd need to ask the system administrator.

A directory that's frequently available to users on unix systems is /home/uuu, where uuu is your userid.

I would ask your SAS system administrator.

Tom
N/A
Posts: 0

Re: Exporting to shared drive from SAS Server

Thanks Tom, I'll contact the SAS admin.
Contributor
Posts: 35

Re: Exporting to shared drive from SAS Server

Brad,

I have had this problem for years and was never able to find the ideal solution you are looking for when using EG an a Unix server. But there are various workarounds in EG depending on what you are doing with this file afterward.

I'd recommend an FTP program like Filezilla or AceFTP to quickly connect to the server's file system and copy it to your computer or shared drives. Setting up an automatic email of your output could have the same effect adn your email might be able to route it appropriately to a shared folder.

For files that are being shared with the company, your SAS admin may have a internal web folder that you can save your results to when you run SAS and then access the files through a bookmark in IE or Firefox.

If you are trying to provide the data or a spreadsheet rather than a report, you could also try proc export to have the data sent to an Access or XLS file on your computer or shared drive. You will need to have PC Files Server (psfservice.exe) running locally when you run proc export in EG, but it can place your file on any of your drives.

None of it is as simple as running SAS on your own computer as most of the samples out there show, but hopefully one of these directions will help. If Tech Support gives you a more elegant solution, please share.
N/A
Posts: 0

Re: Exporting to shared drive from SAS Server

Hi Barry,

Thanks for the reply, the code is not written by EG so it must be a blob. The frustrating thing is that we are able to create an EG processing step that will complete the export but we don't seem to have any control over it other than in the wizard i.e. we can't make it dynamic etc.

Cheers.
Ask a Question
Discussion stats
  • 11 replies
  • 3511 views
  • 0 likes
  • 4 in conversation