Create .CSV File Documenting SAS Dataset Creation Dates

Note: This program was developed on a 32-bit Windows system.

Generating Paths Based on Dictionary.Tables variables memname & crdate:

%let basearchivepath=S:pathtodatasets;
%let pathLabel=New Cohort SAS Datasets;
%put base=&basearchivepath. label=&pathLabel.;

libname febstat 'S:pathtoSASlib';

PROC SQL noprint;
   create table foo as
   select memname, crdate
   from   dictionary.tables
   where  libname="FEBSTAT"
   order by crdate;
QUIT;

data foo;
     set foo;
length Path $255;
label createDate = 'Create Date'
      memname = 'Dataset (Member) Name'
      Path = 'Path to Data';
createDate=datepart(crdate);
fmtDate=put(createDate,yymmdd10.);
path="&basearchivepath."||compress(fmtDate) ||""||"&pathLabel.";
format createDate yymmdd10.;
drop crdate fmtDate;
run;

proc sort data=foo;
     by memname createDate;
run;

ods listing close;
ods csv file="pathtooutput.csv";
 proc print data=foo noobs label;
      var memname createDate Path;
 run;
ods csv close ;
ods listing;

Download SAS Program
View Output

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>