Using Passwords in a Script File

Passwords can be specified for a script file in any of these forms:
  • a clear-text password that is hardcoded into the script
  • a prompt for a user-supplied password as input to the script
  • an encoded password that replaces a clear-text password in the script
The first and second forms offer the least security. The last form promotes security and enables you to store SAS programs that do not contain clear-text passwords.
To obtain an encoded password, specify the clear-text password in the PROC PWENCODE statement. For complete details about PROC PWENCODE, see the Base SAS Procedures Guide.
Here is an example of code that is used to obtain an encoded password:
proc PWENCODE in="My2008PW";run;
{sas001}TXkyMDAzUFc=
The clear-text password My2008PW is specified in the PROC PWENCODE statement. The output is generated in the form {key}encoded-password, where sas001 is the key and TXkyMDAzUFc= is the encoded password that is generated. SAS/CONNECT uses the key to decode the encoded password to its clear-text form when the password is needed.
Note: The encoded password is case-sensitive. Use the entire generated output string, including the key.
Substitute the encoded password for the clear-text password in a script. The encoded password is the output that is generated from the PROC PWENCODE statement.
Note: Macro variables can also be used in script files to capture different user IDs and passwords. This eliminates the need for prompting the user for this information. Enclose the macro variable in double quotation marks in the script.