|
> From: Quentin McMullen [mailto:quentin_mcmullen@BROWN.EDU]
> We've got a group-wide macro library and in that library are
> lots of different macros written by lots of different programmers etc.
>
> An obvious improvement would be for us to standardize on a
> macro header (with macro name, description, parameter list
> etc.), and preferably one that would allow us to read through
> all of the macro code sitting in our autocall library to
> build some sort of table of contents.
>
> I know this sort of structure is common. Before we re-invent
> the wheel, I wondered if folks would be willing to share
> their macro headers and/or code they have used to process
> their macro headers.
my latest Style Sheet for Macros
is something like:
Declaration
/*macro MainVerb one-line Description
input : a b c
process: Delineation of algorithm
output : object produced or value returned
is : function, procedure
usage:
function:
%Let mVar = %MainVerb(...);
procedure:
%MainVerb(Parm1 = x
,Parm2 = y
);
*** close header */
%MACRO MAINVERB
(Library = Library /*default*/
,Data = /*required*/
,Var = /*required*/
,I =1/*local: loop counter*/
,Testing =&SiteTest /*use of %global mVar*/
);
%*insert macro algorithm here;%Mend;
Note-1 that one can cut&paste the parameter list:
%MACRO MAINVERB
(Library = Library /*default*/
,Data = /*required*/
and edit to
%MAINVERB(Library = Work
,Data = ABC
123456789
^^^^^^^^^ note the alignment of columns
ah, the trivial use and ultimate functionality of white-space usage!
Note-2: note carefully the declaration of %local mVar(s) in the
parameter list
Note-3: note carefully the use of %global mVars by %local mVar(s)
my macro Args reads and prints the header and the macro parameter list
i.e. to the closing semicolon after '%MACRO'
check our most excellent archives:
http://www.listserv.uga.edu/archives/sas-l.html
search for:
subject contains: args
author's address: RJF2
since: 19 Nov 1999
until: 19 Nov 1999
as always, Try to be Helpful
and not the StyleSheet commandante.
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
see also these papers:
SUGI 25: 2000 Indianapolis IN
App Dev 38 Writing for Reading SAS Style Sheet
The Writing for Reading SAS (r) Style Sheet:
Tricks, Traps & Tips from SAS-L's Macro Maven
http://www2.sas.com/proceedings/sugi25/25/ad/25p038.pdf
presented at NESUG-2000
http://www.nesug.org/Proceedings/nesug02/at/at011.pdf
SUGI 26: 2001 Long Beach CA
Beg Tutor 66 Macro Tour
A Beginner's Tour of a Project using SAS(r) Macros
Led by SAS-L's Macro Maven
http://www2.sas.com/proceedings/sugi26/p066-26.pdf
|