Date: Fri, 2 Sep 2005 14:58:03 -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: Macro Variable
In-Reply-To: <200509022104.j82JVXLH025130@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed
miguel_hoz@YAHOO.ES wrote back:
>The only way I get this loop to work is writing &&&ptype&i..amtemo, but in
>some cases the loop is working and in some cases no... I send you the log
>output.
>
>Many thanks.
>
>%macro ptype;
>
>%do i=1 %to 6;
>
>%put &&ptype&i;
>
>proc means data = cli_pro(where =(ptype="&&ptype&i")) noprint;
>
>by CLIENT;
>
>VAR status BALANCE_1 BALANCE_2 BALANCE_3;
>
>output out=cli_&&ptype&i(drop=_freq_ _type_)
>sum(balance_1)=&&&ptype&i..amtemo
>
>sum(balance_2)=&&&ptype&i..amtini
>
>sum(balance_3)=&&&ptype&i..amtmon
>
>max(status)=s&&&ptype&i;
>
>run;
>
>%end;
>
>%mend;
>
>%ptype;
>
>1841 %ptype;
It looks to me as if you are making things more and more complex, while not
solving the underlying problems.
Perhaps you could write back to the list and explain why you need this
macro manipulation at all. If all you need is to have the PROC SUMMARY
information split by the values of PTYPE, then you ought to be doing this
using BY-variable processing and keeping the results in one data set for
easier manipulation further on. By forcing this into a macro structure,
you're
making this really complicated, and you're making the code harder to read
and fix, and you're probably making the program run a lot slower. Not to
mention that you're using up way more of your own time!
HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/