I am not sure that the SI Tech Support examples should have all the error
checking that Chang wanted to throw in the macro. The examples should be
clear concise and easy to read and get going, as well as be illistrative.
Too much error checking in an example well is just over kill and even
detrimental to an example. However, any code solution on the SI Tech
Support web sit should follow basic rules of good practices and sound
advice. Such as with thier macros having atleast a somewhat good Macro
Look at Example SAS Sample 1728:
The first method well lets say is soooo bad it shouldnt even be up there,
anyone doing this should be sat down and have a long long long talking too.
Its overly complex, not very flexable, not readable at all, too many peice
and parts for things to go wrong, and finally creates global macro variables
and potentially alot of them when they are not needed. And people wonder
why they hate macro programming so much, with examples like these it is
making a bad problem worse.
Now the second method is atleast some what better in that it simplifies
things greatly. However the Macro %Break, uses positional parameters,
poorly named macro, needs more parameters to be of any real use other than a
cheesy hunk of code ( Ie. Input dats set, a proper where clause that takes
any number of variables and value for teh subsetting and and output data set
name parameter) , and the Call Execute isnt done properly, it should be:
Call Execute( '%NrStr( %Break( ' || trim( Color ) || ' ) ) ' ) ;
Notice the %NrStr in the Call Execute, that is designed so the Valuye passed
to the Stack doesnt get filled up too fast. Basically in the web sites
example it would pass the entire data step code back to the stack. While is
is well and good for a small data set with a relatively few groups it could
be a bad thing if the groups were large and/or the data step code inside of
%Break is relatively large. By Placing %NrStr in the Call Execute it stops
the macro %Break from executeing and places the Macro Call on the Stack,
which after the data step boundry is reach will then execute the macro.
No as for the sascommunity.org, do we really want a macro library. Well I
would say yes and no. I would like to have one and there are those who have
paced some Macros on there already. I believe Don and Ron both have,
actually they were on there before the Wiki went public. However, since
people tend to get Macro crazy and delusional, I wouldnt want everyone to
start dumping their macros on their. Many times we see people who create
macros where they shouldnt have created macros. So I would caution against
getting too happy with placing macros on the sascomunnity.org. Dont get me
wrong if it is a good macro well designed and well usefull hunk of code then
by all means get it up tere and fast, however think about it before you do
You can see a lot by just looking. ~Yogi Berra
Do not seek to follow in the footsteps of the wise. Seek what they sought.
You never know what is enough, until you know what is more than enough.
~William Blake, Proverbs of Hell
From: Graham Murray <graham.murray@WEBMINER.CO.UK>
Reply-To: Graham Murray <graham.murray@WEBMINER.CO.UK>
Subject: Re: SAS Sample 1728 Was ---> Re: SAS Sample 1727
Date: Thu, 3 May 2007 04:36:43 -0400
Nice thread guys .... I guess this is what open source development is all
Got me thinking about suggesting a code/macro library on sascommunity.org?
Need a break? Find your escape route with Live Search Maps.