LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Dec 2002 09:46:26 -0500
Reply-To:     "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (PHPPO)" <rjf2@CDC.GOV>
Subject:      Re: macro design and policy
Comments: cc: Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>,
          "SAS-L Peter Crawford (peter.crawford@db.com)" <peter.crawford@db.com>
Content-Type: text/plain

as illustrated in my previous post: tip macro function SymChk I see a need to consense upon some programming issues.

Point #1: What is the range of the macro value returned?

Carpenter's SymbolCheck macro returns a string in (YES,NO)

in other code which uses this convention of returned strings and other authors' code which returns a string in (yes,no) in order to standardize handling the different UPCASE or lowcase responses one is required to use the ungainly test:

%IF %substr(%upcase(&yesnoOrYESNO.),1,1) eq 'Y' %THEN

if one uses the convention of having macro functions return boolean values, which I highly recommend, this test could be reduced to

%IF &ZEROorONE. %THEN

Point #2: How is the value returned?

Carpenter's SymbolCheck macro uses a temporary macro variable i.e., a %local mvar, YESNO to contain the value. which he then returns with the phrase: (not statement) &YESNO.

I agree that this is a good example of a simple macro that calculates a value and then returns it. Dividing the task up into two steps is correct for illustration.

I highly recommend returning simple values by the convention I illustrate in my version of SymChk:

%IF <cond> %THEN 0; %ELSE 1;

which does not require the necessity of using an intermediate %local macro variable.

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov

Repetition obfuscates! Repetition reduction enhances elegance! Repetition reduction furthers finesse!

CLOCK debugging clue#2: a macro function does not return SAS semicolons


Back to: Top of message | Previous page | Main SAS-L page