Date: Thu, 20 Jun 2002 11:41:21 -0400
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: Some Basics About Macro Variables
Content-Type: text/plain; charset="iso-8859-1"
> From: Ian Whitlock [mailto:WHITLOI1@WESTAT.COM]
> Subject: Some Basics About Macro Variables
> Summary: Still another beginning macro tutorial
> First of all let's get clear what the macro facility does. It
> processes macro instructions plus constant text to make SAS code which
> is then fed continuously to the SAS compiler and executed on step
> boundaries or at the end of global statements. This means that 4
> important times are intertwined:
> 1) macro compile time (when macro is stored)
> 2) macro execution time (when execution of macro instructions
> generates SAS code)
> 3) SAS compile time (when generated SAS code is compiled)
> 4) SAS execution time (when compiled SAS code is executed)
> Hence the macro language is a programming language for generating SAS
> programs. It is completely distinct from SAS.
I think that the main problem people have in both reading
and then writing the two programming languages together in the same
document/program is a result of not understanding this four step sequence.
What everyone needs are macro/SAS bifocals!
First read the macro code in the high lens, the fore-sight focus,
then read the SAS code in the low lens, the near-sighted focus!
LOL :-D We could eliminate a lot of squinting!
I recommend differentiating macro statements from SAS statements:
* ALL CAPS for macro statements
* lower case for SAS keywords
* MixedCase for VarNames
see my papers:
SUGI 25: 2000 Indianapolis IN
App Dev 38 Writing for Reading SAS Style Sheet
The Writing for Reading SAS ® Style Sheet:
Tricks, Traps & Tips from SAS-L's Macro Maven
SUGI 26: 2001 Long Beach CA
Beg Tutor 66 Macro Tour
A Beginner's Tour of a Project using SAS® Macros
Led by SAS-L's Macro Maven
note: new&improved version, with discussion of Templates
to be presented at NESUG this fall.
best example of the Writing for Reading SAS Style Sheet:
Adv Tutor pg 53
%INVALID: a data review macro
using proc FORMAT option other=INVALID to identify and list outliers
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov