BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
12 REPLIES 12
twocanbazza
Quartz | Level 8
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
deleted_user
Not applicable
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??
twocanbazza
Quartz | Level 8
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
TomKari
Onyx | Level 15
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
deleted_user
Not applicable
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
twocanbazza
Quartz | Level 8
I think Tom is on the right track so will leave you two to it.

Hopefully works

Barry
deleted_user
Not applicable
Thanks for your help anyway Barry Message was edited by: BradB
TomKari
Onyx | Level 15
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
deleted_user
Not applicable
Thanks Tom, I'll contact the SAS admin.
rab24
Calcite | Level 5
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.
deleted_user
Not applicable
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.
GenDemo
Quartz | Level 8

I have a very similar problem.

We used to have desktop licenses for SAS/PC, and recently moved to a server solution (also PC). And its giving us endless grief. Desktop setups are just so much simpler to work with. We can't import/export files to/from network drives, even with the network drives mapped.
After a while we figured out that we can import, if you use the import step in EG, but not have any code accociated with it. Similarly we can export excel files to the network, but we can't export SAS data files (.sas7bdat) files to the network wit this method. It keeps on giving the error "Unable to export to xxxxxx.sas7bdat. Please ensure the target file is not already open within your project. If so, please close the file and try again."

 

I'd appreciate it if anyone has any insights...

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 9730 views
  • 0 likes
  • 5 in conversation