|
For the, the most useful techniques for avoiding macros are:
- Using PROC SQL with the :INTO clause to generate code.
- Using BY groups.
- Using CALL EXECUTE to write data-dependent code.
- Using PUT to write data dependent code to a temporary file, then
%INCLUDEing that file.
--
JackHamilton@FirstHealth.com
Manager, Technical Development
Metrics Department, First Health
West Sacramento, California USA
>>> "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM> 06/11/2004 2:32 PM
>>>
On Thu, 10 Jun 2004 15:45:39 +0000, Ian Whitlock <iw1junk@COMCAST.NET>
wrote:
>... If you like the simplicity just avoid writing
>macros. Having no parameters does make code simpler, albeit
>less flexible.
Hi,
I totally agree with you on that it is wonderful that sas keep things
so
that things work even after two decades of upgrades.
With all the due respect, however, I guess I disagree on three points.
One: the lack of parameters can be readily overcome:
macro _put2log
data _null_;
put _line;
run;
%
macro _line "this is a test line" %
_put2log
macro _line "another test line" %
_put2log
Two: name conflicts are not completely disappeared with modern-style
macros, either -- and can be avoided by applying styles or guidelines
strictly, also as shown above. And finally, I would like to avoid
macros,
if I can. Maybe it is just me, but as long as I am to be proficient in
sas, there seems to be no way avoiding macros. I would love to hear
about
ways to not using macros.
Cheers,
Chang
|