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 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 232 views
  • 0 likes
  • 3 in conversation