DATA Step, Macro, Functions and more

How do I make Automated Documentation

Reply
N/A
Posts: 0

How do I make Automated Documentation

Not sure whether I'm at right spot, I wanted to know if I can make documentation of SAS codes automated. I heard it can be done using Macros. Please suggest on this.

Also, if this isn't the right place to ask questions like this, please let me know.. Thanks!
SAS Super FREQ
Posts: 8,866

Re: How do I make Automated Documentation

Posted in reply to deleted_user
Hi:
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?

With or without a SAS macro program, you can easily get dataset and variable information from the various DICTIONARY.xxx files or their equivalent SASHELP.yyy files. For more information, look at some of these resources:
http://support.sas.com/documentation/cdl/en/sqlproc/59727/HTML/default/a001385596.htm
http://www2.sas.com/proceedings/sugi28/118-28.pdf
http://www2.sas.com/proceedings/forum2007/235-2007.pdf
http://www2.sas.com/proceedings/sugi29/237-29.pdf
http://support.sas.com/kb/25/436.html
http://www2.sas.com/proceedings/forum2007/103-2007.pdf

cynthia
SAS Employee
Posts: 174

Re: How do I make Automated Documentation

Posted in reply to deleted_user
Hi GP

What do you want documented from your SAS code ?

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)
[pre]
Filename dirlist pipe 'dir p:\*.sas /B';
data fnames(keep=filename);
infile dirlist pad missover;
input @1 filename $62.;
run;

data sascode;
retain file;
length string $120;
set fnames(keep=filename obs=10);
infile dummy filevar=filename end=done dsd;
file=filename;
do while(not done);
input string :$120.;
output;
end;
run;
[/pre]

You will have to do some IF testing using substr(), index() etc. when reading your standard header.

See the following papers for ideas
http://www2.sas.com/proceedings/sugi25/25/cc/25p074.pdf
http://www2.sas.com/proceedings/sugi27/p208-27.pdf
http://www2.sas.com/proceedings/sugi29/258-29.pdf
SAS Employee
Posts: 174

Re: How do I make Automated Documentation

Posted in reply to GertNissen
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
Ask a Question
Discussion stats
  • 3 replies
  • 125 views
  • 0 likes
  • 3 in conversation