Previous Page | Next Page

The PWENCODE Procedure

Example 2: Using an Encoded Password in a SAS Program


Procedure features:

IN= argument

OUT= option


This example illustrates the following:


Program 1: Encoding the Password

 Note about code
filename pwfile 'external-filename'
 Note about code
proc pwencode in='mypass1' out=pwfile;
run;

Program 2: Using the Encoded Password

 Note about code
filename pwfile 'external-filename';
 Note about code
options symbolgen;
 Note about code
data _null_;
   infile pwfile obs=1 length=l; 
   input @;
   input @1 line $varying1024. l; 
   call symput('dbpass',substr(line,1,l)); 
run;
 Note about code
libname x odbc dsn=SQLServer user=testuser password="&dbpass";

Log

28   data _null_;
29      infile pwfile obs=1 length=len;
30      input @;
31      input @1 line $varying1024. len;
32      call symput('dbpass',substr(line,1,len));
33   run;

NOTE: The infile PWFILE is:
      File Name=external-filename,
      RECFM=V,LRECL=256

NOTE: 1 record was read from the infile PWFILE.
      The minimum record length was 20.
      The maximum record length was 20.
NOTE: DATA statement used (Total process time):
      real time           3.94 seconds
      cpu time            0.03 seconds


34   libname x odbc
SYMBOLGEN:  Macro variable DBPASS resolves to {sas002}bXlwYXNzMQ==
34 !                dsn=SQLServer user=testuser password="&dbpass";
NOTE: Libref X was successfully assigned as follows:
      Engine:        ODBC
      Physical Name: SQLServer

Previous Page | Next Page | Top of Page