Limit access to directories within a SAS program

Limit access to directories within a SAS program

Post by eutociu » Sun, 08 Mar 2009 03:44:34


I write several SAS programs a day to address various ad-hoc
questions. I periodically have to create permanent datasets, but am
constantly simply reading from a vast number of them, and a few times
a year I space out and write something like

data small_subset;
data exntlsource.very_important_data;
if missing( *** _type);
run;

Replacing a huge data set with a one with one row, one variable, and a
missing value for that.

This is of course embarrassing and time-consuming as I go knocking on
doors with my hat in hand figuring out how to get the data recreated.
If you just take my word for it that removing my write access to all
of this data in the file system (UNIX, fwiw) is unfeasible and would
create more problems, is there some option I can set in a given
program that would simply prevent that particular program from writing
to anything but the work directory?

Thanks
 
 
 

Limit access to directories within a SAS program

Post by iebupdt » Sun, 08 Mar 2009 03:57:35

libname exntlsource 'path' access=readonly;

 
 
 

Limit access to directories within a SAS program

Post by HERMANS » Sun, 08 Mar 2009 04:05:39

I'd recommend setting up views of permanent views of permanent datasets and using them as sources of data. (Views have become the duct tape of database programming.) For example,

proc sql;
create view perm.vwdsn as
select * from perm.dsn
;
quit;

After creating the permanent view, you can thereafter use the view reference in lieu of the dataset reference in all but a few Data step programs and procedures (Exceptions include some direct access programs that could take longer to run and some programs that use indexes on permanent datasets.) Views require very little storage space and fractions of seconds of execution time. As a precaution, I'd also recreate the permanent view when recreating the permanent dataset.
S

-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of XXXX@XXXXX.COM
Sent: Friday, March 06, 2009 1:45 PM
To: XXXX@XXXXX.COM
Subject: Limit access to directories within a SAS program


I write several SAS programs a day to address various ad-hoc questions. I periodically have to create permanent datasets, but am constantly simply reading from a vast number of them, and a few times a year I space out and write something like

data small_subset;
data exntlsource.very_important_data;
if missing( *** _type);
run;

Replacing a huge data set with a one with one row, one variable, and a missing value for that.

This is of course embarrassing and time-consuming as I go knocking on doors with my hat in hand figuring out how to get the data recreated. If you just take my word for it that removing my write access to all of this data in the file system (UNIX, fwiw) is unfeasible and would create more problems, is there some option I can set in a given program that would simply prevent that particular program from writing to anything but the work directory?

Thanks
 
 
 

Limit access to directories within a SAS program

Post by Lou » Sun, 08 Mar 2009 09:53:43


You can prevent write access when you assign your libraries, as in:

LIBNAME EXNTLSOURCE "your-physical-directory-name-here" ACCESS = READONLY;

Make it a standard practice to use "access = readonly" on all libraries that
you do not plan to write to - it takes but a moment. (I **require** the
programmers in my office to do this.) As to recreating the data you just
overwrote so mistakenly, it shouldn't be any more trouble than a call to the
IT department with a request for a restore from the latest backup. I have
nothing to suggest for dealing with the embarrassment.