DATA Step, Macro, Functions and more

Base Library-level password protection

Accepted Solution Solved
Reply
Super Contributor
Posts: 268
Accepted Solution

Base Library-level password protection

I'm setting up a proof-of-concept mini-bijou-datamartette. Because the source Microsofty tables are quite sensitive, I must retain security while I go about my investigation phase.

 

I don't have access to Management Studio (although I'm working on it) and the tables aren't registered with metadata, so I'm cutting my code by hand. It's not ideal, but it's just the way things are.

 

When I bring the staging data over from the source, can I code a Base-engined libname with a read and write passwords over every dataset, or do I have to apply the passwords individually to each target dataset? If the latter I don't really mind, but it'd be easier if I could apply them higher up.

 

Ngā mihi nui,

Laurie


Accepted Solutions
Solution
Thursday
Super User
Posts: 23,724

Re: Base Library-level password protection

I don't see anything on the libname that indicates this is possible. That doesn't mean it doesn't exist though. 

 

Here's a macro approach that you can use if desired. 

 



%macro lockdown(lib=, datain=, pw=, alter=, read=, write=);

proc datasets lib=&lib.;
modify  &datain. (pw=&pw alter=&alter read=&read write=&write);
run;quit;

%mend;

%let lib=demo;

data check;
length str $200.;
format str $200.;
set sashelp.vtable (keep= libname memname);
where libname=upcase("&lib");
str = catt('%lockdown(lib= ', libname, 
                    ', datain=', memname,
                    ', pw=', 'Password1',
                    ', alter=', 'Password2',
                    ', read=', 'Password3',
                    ', write=', 'Password4',
                    ');');
*call execute(str);
run;

View solution in original post


All Replies
Solution
Thursday
Super User
Posts: 23,724

Re: Base Library-level password protection

I don't see anything on the libname that indicates this is possible. That doesn't mean it doesn't exist though. 

 

Here's a macro approach that you can use if desired. 

 



%macro lockdown(lib=, datain=, pw=, alter=, read=, write=);

proc datasets lib=&lib.;
modify  &datain. (pw=&pw alter=&alter read=&read write=&write);
run;quit;

%mend;

%let lib=demo;

data check;
length str $200.;
format str $200.;
set sashelp.vtable (keep= libname memname);
where libname=upcase("&lib");
str = catt('%lockdown(lib= ', libname, 
                    ', datain=', memname,
                    ', pw=', 'Password1',
                    ', alter=', 'Password2',
                    ', read=', 'Password3',
                    ', write=', 'Password4',
                    ');');
*call execute(str);
run;
Super Contributor
Posts: 268

Re: Base Library-level password protection

Thanks, Reeza! Nicely done. I was thinking along those lines but had been putting it off. Having it a library level would be handy though.

 

In a perfect world I'd get metadata to control it...oh well.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 52 views
  • 3 likes
  • 2 in conversation