BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm not sure if this is the right forum section for this question, but direct me if I'm in the wrong place.

I've created a process to use SQL server to create a password and store it in a SQL table. Then I've created sas code to read the password value into a variable and then pass it along inside sas script to read a SPDS table.

Now I want to know if its possible to have the variable (and its return value) stored in autoexec, so I don't need to call the READ= code everytime I read a SPDS table.
Maybe I can use READ= value when I define libname inside autoexec?

=========================== Code ===========================
LIBNAME data sasspds host="sas01" serv="5190" user="spdsadm" ip=yes schema= "DATA" password="XXX" compress=yes;



/***********************************************************************/
/*** READ ***/
/*** code to auto pull read_key from SQL table ***/
/*** and read SPDS table content ***/
/***********************************************************************/
proc sql;
/* Put the resultset (1st row) into a varibale pw */
/* SAS PW is MAX 8 char long, here we take the 1st 8 Chars */
connect to odbc(uid=XXX pwd=XXX dsn="SQLServer03" );
select compress(read_key) into :r_pw from connection to odbc
(select top 1 read_key from DB..SAS_SPDS_KEY);
disconnect from odbc;
quit;

options symbolgen;

proc contents data= data.TABLE_1(read=&r_pw);
run;

proc contents data= data.TABLE_2(read=&r_pw);
run;

proc contents data= data.TABLE_3(read=&r_pw);
run;

....
/***********************************************************************/
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
I haven't been successful with formally encrypting. We did find an alternative that works for us for batch SAS runs.

We put the LIBNAME in a %INCLUDE file that is only available to the person(s) running the program. (We put it in the user's home directory as we require each individual to use his or her own password.) SAS takes care of converting it to x's for the log and it is never in the .SAS files that others might be able to get to.
darrylovia
Quartz | Level 8
If your purpose is to mask the password PROC PWENCODE is a usefull method.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1242 views
  • 0 likes
  • 3 in conversation