Previous Page | Next Page

File Protection

Assigning Passwords


Syntax

To set a password, first specify a SAS data set in one of the following:

Then assign one or more password types to the data set. The data set might already exist, or the data set might be one that you create. The following is an example of syntax:

password-type=password <... password-type=password>)
where password is a valid eight-character SAS name and password-type can be one of the following SAS data set options:

ALTER=

PW=

READ=

WRITE=

CAUTION:
Keep a record of any passwords you assign!

If you forget or do not know the password, you cannot get the password from SAS.  [cautionend]


Assigning a Password with a DATA Step

You can use data set options to assign passwords to unprotected members in the DATA step when you create a new SAS data file.

This example prevents deletion or modification of the data set without a password.

   /* assign a write and an alter password to MYLIB.STUDENTS */
data mylib.students(write=yellow alter=red);
   input name $ sex $ age;
   datalines;
Amy f 25
... more data lines ...
;

This example prevents reading or deleting a stored program without a password and also prevents changing the source program.

   /* assign a read and an alter password to the SAS view ROSTER */
data mylib.roster(read=green alter=red) / 
     view=mylib.roster;
   set mylib.students;
run;

.

libname stored 'SAS-library-2';

   /* assign a read and alter password to the program file SOURCE */
data mylib.schedule / pgm=stored.source(read=green alter=red);
   ... DATA step statements ...
run;

Note:   When you replace a SAS data set that is alter-protected, the new data set inherits the alter password. To change the alter password for the new data set, use the MODIFY statement in the DATASETS procedure.   [cautionend]


Assigning a Password to an Existing Data Set

You can use the MODIFY statement in the DATASETS procedure to assign passwords to unprotected members if the SAS data file already exists.

   /* assign an alter password to STUDENTS */
proc datasets library=mylib;
   modify students(alter=red);
run;


Assigning a Password with a Procedure

You can assign a password after an OUT= data set specification in some procedures.

   /* assign a write and an alter password to SCORE */
proc sort data=mylib.math 
   out=mylib.score(write=yellow alter=red);
   by number;
run;

You can assign a password in a CREATE TABLE or a CREATE VIEW statement in PROC SQL.

   /* assign an alter password to the SAS view BDAY */
proc sql;
   create view mylib.bday(alter=red) as
      query-expression;


Assigning a Password with the SAS Windowing Environment

You can create or change passwords for any data file using the Password Window in the SAS windowing environment. To invoke the Password Window from the ToolBox, use the global command SETPASSWORD followed by the filename. This opens the password window for the specified data file.


Assigning a Password Outside of SAS

A SAS password does not control access to a SAS file beyond the SAS system. You should use the operating system-supplied utilities and file-system security controls in order to control access to SAS files outside of SAS.

Previous Page | Next Page | Top of Page