Assigning Passwords


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

  • a DATA statement

  • the MODIFY statement of the DATASETS procedure

  • an OUT = statement in PROC SQL

  • the CREATE VIEW statement in PROC SQL

  • the ToolBox.

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:

  • ALTER=

  • PW=

  • READ=

  • WRITE=


  • Keep a record of any passwords you assign! If you forget or do not know the password, you cannot get the password from SAS.

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 view ROSTER */  data mylib.roster(read=green alter=red) /       view=mylib.roster;     set mylib.students;  run;  libname stored '  SAS-data-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.

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=mylib;     modify students(alter=red);  run; 

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=mylib.math     out=mylib.score(write=yellow alter=red);     by number;  run; 

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

SAS 9.1 Language Reference. Concepts
SAS 9.1 Language Reference Concepts
ISBN: 1590471989
EAN: 2147483647
Year: 2004
Pages: 255 © 2008-2017.
If you may any questions please contact us: