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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.