Date: Tue, 17 Oct 2006 13:23:40 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: How to reference a macro vatiable generated from a macro
within a separated macro
In-Reply-To: <445d9dbe0610171255o22f9c640vf81af6875656143e@mail.gmail.com>
Content-Type: text/plain; format=flowed
zhangyu05@GMAIL.COM wrote:
>
>data _null_,
>
>thank you for taking time to answer my question.
>
>what I am trying to do is create a macro varaible on the fly and use it in
>later part of program.
Why? And why make the second part of the process so hard?
Really. I'm (trying to be) serious about this.
First off, I don't like creating global variables if I don't have to. I
like to carefully control my macro variable scope so I don't have to
worry about things like namespace collisions and making macros too
unwieldy to re-use.
Second, there are other ways to compute a data point (or a bunch
of them) and have the data available later in the program. A macro
variable may be a good approach, but it is not the only approach.
Third, using that created macro should be *transparent*. It is,
after all, just the 'text substitution' you talked about earlier. Needing
an entire data step to cope with it seems counter-intuitive.
Fourth, a complex process may be a lot easier to write the first
time if you start out with a non-macro solution (that may only work
for special case) and then macro-ize it to get what you need.
>I know I can take out the data _null_ and run statements from first macro,
>but there going to be many many repeated statements in one datastep when it
>is resolved.
Why? What do the "many many repeated statements" do?
You may have a situation that is screaming for a macro solution.
But you may have a situation which is done better with other
tools.
>Do you have any suggestion or idea of how to make it happen?
>
>Thank!
>
>Yu
My suggestion here is for you to explain in great detail what your
process needs to do, and why, so that the people on SAS-L can
give you better advice than the kvetching above.
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Use your PC to make calls at very low rates
https://voiceoam.pcs.v2s.live.com/partnerredirect.aspx