BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mkb321
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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;

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

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;

 

Patrick
Opal | Level 21

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 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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