Using Password-Protected SAS Files in DATA and
PROC Steps
To access password-protected files, use the same data set options that you use to assign
protection.
/* Assign a read and alter password to the stored program file*/
/*STORED.SOURCE */
data mylib.schedule / pgm=stored.source
(read=green alter=red);
<… more DATA step statements …>
run;
/*Access password-protected file*/
proc sort data=mylib.score(write=yellow alter=red);
by number;
run;
/* Print read-protected data set MYLIB.AUTOS */
proc print data=mylib.autos(read=green);
run;
/* Append ANIMALS to the write-protected data set ZOO */
proc append base=mylib.zoo(write=yellow) data=mylib.animals;
run;
/* Delete alter-protected data set MYLIB.BOTANY */
proc datasets library=mylib;
delete botany(alter=red);
run;
Passwords are hierarchical in terms of gaining access. For example, specifying the
ALTER password gives you Read and Write access. The following example creates the
data set States, with three different passwords, and then reads the data set to produce a
plot:
data mylib.states(read=green write=yellow alter=red);
input density crime name $;
datalines;
151.4 6451.3 Colorado
… more data lines …
;
proc plot data=mylib.states(alter=red);
plot crime*density;
run;
How SAS Handles Incorrect Passwords
If you are using the SAS windowing environment and you try to access a password-
protected member without specifying the correct password, you receive a dialog box that
prompts you for the appropriate password. The text that you enter in this window is not
How SAS Handles Incorrect Passwords 733

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.