Your SAS programs, embedded in web apps and elsewhere

creating a folder on local drive

Reply
Regular Contributor
Posts: 229

creating a folder on local drive

FILENAME mkdir pipe "mkdir d:\newfolder";
data _null_;
input mkdir;
put _infile_;
run;

LOG:

56719 FILENAME mkdir pipe "mkdir d:\newfolder";
ERROR: Insufficient authorization to access PIPE.
ERROR: Error in the FILENAME statement.
56720 data _null_;
56721 input mkdir;
56722 put _infile_;
56723 run;

ERROR: No DATALINES or INFILE statement.
ERROR: The _INFILE_ variable has been referenced, but no DATALINES or INFILE statement was found.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds Message was edited by: Filipvdr
SAS Super FREQ
Posts: 8,743

Re: creating a folder on local drive

Hi:
You may need to talk to your System Administrator:
[pre]
ERROR: Insufficient authorization to access PIPE.
[/pre]

Also, where, exactly are you trying to create the directory and are you doing this in the context of a stored process. For example, if your SP is running on a SAS server on a Unix box, there's probably not a D: drive on that server. You may need to have the PIPE capability turned on and/or change your path.

You might consider working with Tech Support on this issue.

cynthia
PROC Star
Posts: 392

Re: creating a folder on local drive

Hi Filipvdr,

In addition to Cynthia's points, if you are running your stored process code in a SAS Stored Process Server or SAS Workspace Server then it is likely that pipes and executing operating system commands have been disabled via the NOXCMD option (it is the default for the SASApp application server). If that is the case then the SAS platform administrator could possibly enable the XCMD option but it has security implications and may not be appropriate.

Another way of creating directories without using pipes or operating system commands is to use the DCREATE function. This is an SCL function but is also available in the data step. Here is an example of creating the newfolder folder in the d:\ parent directory (i.e. d:\newfolder):

data _null_;
newdirname=dcreate('newfolder', 'd:\');
put newdirname=;
run;

You can use it in the %sysfunc macro function too:

%let newdir=%sysfunc(dcreate(newfolder,/tmp));
%put &newdir;

You should find that dcreate works even when NOXCMD is in effect. The documentation for the dcreate function at http://support.sas.com/documentation/cdl/en/sclref/59578/HTML/default/viewer.htm#a000308115.htm

Cheers
Paul
Ask a Question
Discussion stats
  • 2 replies
  • 5075 views
  • 0 likes
  • 3 in conversation