11-20-2014 10:02 AM
I would appreciate if someone can provide me the alternatives for the following statement which should run in SAS EG 5.1?
Log below indicates that filename statement is unsuccessful.
filename indat1 pipe 'ls -d /data/Resource/Alert/daily_files/*' ;
ERROR: Insufficient authorization to access PIPE.
ERROR: Error in the FILENAME statement.
11-20-2014 11:37 AM
If you can enter the ls -d /data/Resource/Alert/daily_files/* from a command line and get a successful listing then you may have an issue with the configuration of SAS. You may need to provide some details of your environment such as are you working with a server based version of SAS. If the data folder isn't subordinate to the location of the SAS current directory then it can't find it. It is a good idea to always provide a full path in a libname statement, which may need to include reference to the server the file is on.
If the command line doesn't work then it is likely an OS issue or possibly a typo for the path.
11-21-2014 01:43 AM
I could succeed the command ls -d /data/Resource/Alert/daily_files/* from command line (UNIX server). Yes, I'm working in a server based SAS and there is no typo in my path name.
11-21-2014 01:51 AM
You are most likely operating under the -noxcmd restriction. This has to be corrected in the metadata for the workspace server.
If you can't get your admin to to it, but have the option of command line access, I suggest you run the program in batch mode. Which would prove the idiocy of keeping noxcmd to the admin.
11-21-2014 02:12 AM
You take your code as written (be aware for EG-specific things like ODS output to the EG channel) and save it to your server under "Files". In most setups this is the home directory you find yourself in when logging on via ssh (or telnet).
Then log on to the server and simply do sas programname.sas. The run will create programname.log (and programname.lst if you have output). Inspect the log file to see if it worked or what went wrong. Make changes to the code and save again, repeat until satisfactory.
11-21-2014 02:16 AM
Please explain your situation as it can be:
1/ your system-admin sas-admin doesn't like you or your are classified by them as a jerk. Is there a bypass for that?
This question is: how well do you know those guys and are you on speaking terms.
2/ Those people having done the sas-installations were just capable of typing a "setup" command. Not cooperating with your business needs. How do you solve that?
This is the service manager, project manager to coordinate but that fails when missing some input on your business needs and sas knowledge aside all internal politics.
One of the to be solved questions in this implementing a good security approach including the OS level controls.
These are the reason why the xcmd is left closed. Having no real OS security defined this is the last thing on not granting functions for that level.
You could try this having it solved now you know this. (open up xcmd !)
If you have access to the relevant business security policies you could ask to how those arer related against eg ISO 27002-2013 9.4.1 as there is explicitly stated those controls are aimed at user actions to sensitive data not at using some functionality/tool. the 9.4.4 is mentioning priviledged utilty programs, imo sas is not that (common sas users)
When you are coding something to process files in sas you can:
- use wildacards in namings. the real filename is returned
- use dopen functions the build a directory list with all information just using sas functions
11-21-2014 03:50 AM
You can try the following:
data dirs(keep=path name);
length name $ 200 path $ 200;
do i = 1 to memcnt;
if did1 then output;
11-21-2014 05:20 AM
Thanks for the response.
I ran your code, but I don't see any differences in the directory. See log below.
14 GOPTIONS ACCESSIBLE;
15 data dirs(keep=path name);
16 length name $ 200 path $ 200;
20 do i = 1 to memcnt;
25 if did1 then output;
NOTE: The data set WORK.DIRS has 0 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
11-21-2014 04:38 AM
Not sure if there is a Unix equivalent as don't use it at the moment. However in DOS you can simply direct the output to a text file and then read that in:
Pop that in a batch file, run it and then run your SAS program to read that text file.
11-21-2014 09:38 AM
So can we the code (tweaking to match to my folders) provided in the link to match with my initial code filename indat1 pipe 'ls -d /data/Resource/Alert/daily_files/*' ; for successful run in EG?
11-22-2014 03:05 AM
It is a macro . replace its parameter as you will .
/* Assigns the fileref of mydir to the directory and opens the directory */
/* Returns the number of members in the directory */
/* Loops through entire directory */
%do i = 1 %to &memcnt;
/* Returns the extension from each file */
/* Checks to see if file contains an extension */
%if %qupcase(%qsysfunc(dread(&did,&i))) ne %qupcase(&name) %then %do;
/* Checks to see if the extension matches the parameter value */
/* If condition is true prints the full name to the log */
%if (%superq(ext) ne and %qupcase(&name) = %qupcase(&ext)) or
(%superq(ext) = and %superq(name) ne) %then %do;
/* Closes the directory */
11-21-2014 10:32 AM
Babloo, unless you solved your xcmd setting with your admins, you can forget using pipe or any other OS commands from SAS on the Unix server (EG is more like a browser terminal). That is where you started with the error message, "ERROR: Insufficient authorization to access PIPE."