I'm not sure what you mean by "SAS codes" -- do you mean the SAS programs themselves, the SAS logs?? Or producing information about the dataset size, number of obs, variable names, labels, formats, etc?
If you want to document your input and output data, its not that simple - because you will have to build your own parser because of the many many ways sas data can be referenced in the SAS code (i.e. datasets, proc's etc and macro var. ref.).
If you want to have basic metadata about your program, like who developed it, when, description, status etc. you can do this by using a standard header in all your programs (at the top). You will need to infile all your sas files in a datastep, and read your header information into a SAS dataset.
Its not necessary to write a macro, a normal SAS program can do the job just fine.
i.e try this mock-up (has to be refined before use - not tested)
Filename dirlist pipe 'dir p:\*.sas /B';
infile dirlist pad missover;
input @1 filename $62.;
length string $120;
set fnames(keep=filename obs=10);
infile dummy filevar=filename end=done dsd;
do while(not done);
input string :$120.;
You will have to do some IF testing using substr(), index() etc. when reading your standard header.
Well - the latest issue of the "SAS® Tech Report - november 2008" has this hint.....
Great Forum Paper Series, Continued: Publishing SAS® Code Documentation »
This paper introduces DocItOut - a free, open source tool specifically developed to traverse messy directories and generate properly formatted Web documentation in HTML format, based on the comments and statements in the SAS code. DocItOut: Publishing SAS® Code Documentation on the Webhttp://www2.sas.com/proceedings/forum2008/232-2008.pdf