I received the below question to this post:

"Problem with PWENCODE is that if someone is able to take the encoded password they are still able to utilize it as SAS will resolve that password. i.e. the &mypw.

So what is the best way to store let say SQL database password that can only be then used by you.. the password should be stored in a encrypted file or sas dataset and then resolved before you run the program.. i.e. providing the Macro Variable with the encrypted key is not a very good protection as that encrypted key can directly be used in a given SAS program."

You have identified a common concern to using the password as I listed above. The "Pro" of using the password like I have listed is that it does not print the actual password in the code or in the log file, and soneone cannot pick it up and go access your database with your userid and password. The "Con" is that someone can utilize SAS itself to run that userid and password.

So what are some ways around this?

Typically, I've put the %let statement above inside my own autoexec file. That way, only running code under my instance of SAS with my SAS login credentials would allow the code to properly run with my encoded password.

What are other ideas you have used for protecting your encrypted password?

Thank you!
Wendy