I have several hundred datasets which all need to have password protection added (the same password for all datasets). The naming convention used is data_yyyyMMMdd with the dates increasing weekly (example: data_2022mar13, data_2022mar20).
Is there a way to modify all datasets in the dataset procedure? I looked at the example date %do loop here: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/n01vuhy8h909xgn16p0x6rddpoj9.htm
however SAS doesn't seem to recognize the yyyyMMMdd date format.
Thanks in advance!
How about this? Run to see how it works and complete as required.
ods output members=MEMBERS;
proc datasets lib=WORK ;
run;
ods output close;
data _null_;
set MEMBERS;
where MEMTYPE='DATA';
if _N_=1 then call execute('proc datasets lib=WORK;');
call execute('modify '||NAME||';');
run;
run;
How about this? Run to see how it works and complete as required.
ods output members=MEMBERS;
proc datasets lib=WORK ;
run;
ods output close;
data _null_;
set MEMBERS;
where MEMTYPE='DATA';
if _N_=1 then call execute('proc datasets lib=WORK;');
call execute('modify '||NAME||';');
run;
run;
If these tables are all in a single or only a few libraries then another option could be the use of metadata bound libraries.
https://go.documentation.sas.com/doc/en/bicdc/9.4/bisecag/n1nesjvtxu7783n1pveml8ct4txk.htm
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.