11-28-2013 08:09 AM
I have the following problem. I'm trying to export some data to my local folder (in the example here to a text-file, but the same happens if trying to export to excel or access).
Here is the program:
proc export data = sashelp.class
outfile = 'c:\dokus\class.txt'
dbms = dlm replace;
delimiter = '09'x;
I obtain this error:
ERROR: Insufficient authorization to access /sas/config/Lev1/SASApp/c:\dokus\class.txt
So, SAS don't unterstand that I want to export to a local folder and tries to export to some location on the remote server (I use SAS which is installed only on this remote server but not locally on my computer). My question - how can I tell SAS that I want to export to a local folder? It must be possible, I think, since I can very well export data to my local folders using SAS EG export wizards. (But this version of export is not sufficient for me because I cannot use macro variables through it).
Thanks in advance,
11-28-2013 09:08 AM
Typically, this means your SAS EG session is hosted remotely. That is, EG is a natural interface to work on a server and thus, a path like 'c:\dokus\class.txt' is local to that server and then obviously, you don't have C drive priviledges on that remote server.
If your data resides on the server, you would need to find the full network path to your computer's C drive. Otherwise, you could just change the server in EG to "local" and run everything locally so it would recognize C:\ paths as local.
So if you have a shared drive user (typically not C:\), that you can read/write to, you can use properties of a folder on that shared drive to retrieve full path and use that to export. Similarly, you should be able to open network, find the network name of your PC on there and use a relative path like \\pcname\users\yourusername\subfolder path\ as an export path.
I'm not a programmer and only use EG on occasion but this is how I run around this problem with local libname statements.
*edit* you can also look at EG export wizard's automatically generated code for a dummy export to your path above and reuse that code. It will probably retrieve and write the appropriate full path for you.
11-28-2013 09:44 AM
Thank you Vincent.
I have no local server because SAS is not installed on my PC. I can only use the remote server.
But the EG export wizard can somehow "find" my local folders.
Unfortunately I don't see how I can obtain the code behind the export wizard. I can only automatically generate code for queries but not for export steps.
And I don't understand how would the full network path to my computer's C drive help me. The problem is that SAS add automatically to my path the following:
"/sas/config/Lev1/SASApp/", no matter what my path is. How I can tell SAS not to do this? That's actually my question.
11-28-2013 02:18 PM
As explained by Vince if you wish to reference your own PC drive you need to specify your OUTFILE like so:
outfile = '\\pcname\mycdrivefolder\subfolder\class.txt'
If you do this then "/sas/config/Lev1/SASApp/" will not appear in your path. It is because you don't have access to the C: drive mapping that you get this error.
You will need to talk to your IT support people to confirm if your SAS server can 'see' your C drive across the network and if so how you would reference it.
11-30-2013 10:24 AM
If the server has no visibility of the C: drive, then the quotes are irrelevant. The automatic usage of /sas/config/Lev1/SASApp/ with a file location/name in EG indicates these possibilities:
1) a client/server install -- usually the Lev1/SASApp directory indicates a BI Platform install -- Usually, you talk to your administrators to get a writeable directory allocated to you on the server and you write your files to that location instead of your C drive.
2) usage of SAS OnDemand license -- which is also a client/server install, but instead of the server being your company's server, the SAS server is located in North Carolina and the client (EG) is on your PC -- this client has a few extra limitations than a company client/server install. For SAS OnDemand for Professionals or SAS OnDemand for Academics, there is a user directory allocated to each account (xxxxxxxx) and you can write to that location. The location will be something like what is shown here for an ODS HTML step:
ODS HTML FILE='/home/xxxxxxxx/user/myreport.html';
proc print data=sashelp.class;
ODS HTML CLOSE;
Using the UNC name, \\pcname\directory\subdir\ method of pointing to a file should work for method #1, with a company client/server install assuming that the SAS server has visibility of \\pcname but will not work in the #2 method because the SAS server does not have visibility of your local machine for reading data files. There is only visibility of the connection between the two machines for running code.
03-03-2014 01:11 PM
Thank you! This worked for me right away. And I was able to download the resulting file to my C:\ drive as well.
03-19-2015 05:22 AM
When I tried the below code to export a dataset to a CSV in local C drive, I got the error as 'Insufficient authorization to access /data/rawdata/SAS_93/biserver/Lev1/SASApp/\\NBRD-DT-VS3034\C\Downloads\class.csv'
proc export data=sashelp.class outfile = '\\NBR-DT-VS303\C\Downloads\class.csv' dbms=csv; /*to export a file in downloads folder in C:\ */
My SAS is installed in server and I ran this code in EG 7.1. Am I doing anything wrong?
Do I need to specify the full computer name or computer name in outfile statement?
03-19-2015 05:27 AM
You need to check with you PC/server/network admin for help on user authorization.
First, do you use IWA in SAS?
Second, try to save it another more server friendly locatin, and try to map that from your PC instead.
03-19-2015 05:31 AM
What was covered here:
also applies to exporting files in a UNIX server session.
07-21-2015 06:36 AM
I'm having some trouble generating the file to a local machine with a program, let me explain:
I have a server with enterprise guide instaled (A) which is then using the libraries in another server(B). So two servers are invloved here. They both belong to my company.
Now, using EG client in Server (A), when I do a export step to csv I am able to generate the file corretly to server (A), however when I use a Program code, I am not able to generate the file to server (A).
The program code I'm using is:
proc export data=WORK.data_Set
How come is this happening, I mean how can I generate a file with "export step" and then fail with the program code?
Does this has to do with visibility / permissions?
How can i fix this?
Thanks in advance
07-21-2015 10:25 AM
ocauser, That is a quite different root cause. As you are te processes running on a windows_server they are not behaving exactly the same way as on your local desktop. It is quite common to run all sas-services (spawner) as services on the Wndows server on the default local-system account. As a result of that you cannount pass use the other non-local-systems in your domain anymore. As your users sessions are spawned from that spawner proces they cannot elevate the rights beyond of that one.
07-21-2015 11:00 AM
Hi Jaap Karman.
First of all, thanks for the quick reply.
I'm not sure that's the cause because if I simply define the outfile paramenter like this:
So doing some recap here:
* When doing Export Step to H drive, since both EG and \\server_name\Share\outfile.txt" path are in server (A), it works
* When doing in program 'outfile="outfile.txt" REPLACE'; although SAS server is in server (B) this still works and file is generated to local directory in (B)
* When doing in program "outfile="\\server_name\Share\outfile.txt" REPLACE"; since this location is in server (A), SAS Server(B) aparently, does not have visibility of Server (A) in the network, and is not able to generate this output file.
From my perspective it seems more a question of network visibility and permissions than anything else. Does this makes sense ???
11-30-2013 02:51 PM
The error is coming form EGuide using to a UNIX server.
As the home directory $HOME and ~ in Unix/Linux is as important as the %appdata% and "my documents", it is a little painfull the default settings by the SAS installation are wrong and ignoring the common Unix guidelines. With BI/DI usage the current dir is used relative and left at an unhappy location.
There is a SAS-note on that: 50345 - Changing the current working directory for the SAS® Workspace Server
I have seen an other correlated mistake in this area. That is the sasautos is also used as relative.path for SASenvironment (Config-files).
It is not an absolute one as other sasautos definitions using the Unix environment variables with a !. Get this to your platform-admin (unix) guy....
Do not use a fully qualified Windows path. Use a single name file.
This will work on every type of server as long as the current directory is set to common conventions.
With Eguide you will find the file (txt) in your Unix home-dir. drag drop download as you like.
This is accessible in the file-tab of the server. The Lev1-location will be normally invisible ....