Chapter Contents



Assigning Passwords


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 may already exist, or the data set may be one that you create. An example of syntax follows:

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:

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 file.

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

   /* assign a write and an alter password to MYLIBNAME.STUDENTS */
data mylibname.students(write=yellow alter=red);
   input name $ sex $ age;
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 view ROSTER */
data mylibname.roster(read=green alter=red) / 
   set mylibname.students;
libname stored 'SAS-data-library-2';

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

Assigning a Password to an Existing Data Set

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

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

Assigning a Password with a Procedure

You can assign a password after an OUT= data set specification in PROC SQL.

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

You can use a CREATE VIEW statement in PROC SQL to assign a password.

   /* assign an alter password to the view BDAY */
proc sql;
   create view mylibname.bday(alter=red) as

Assigning a Password with the SAS Windowing Environment

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

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.