Date: Tue, 18 Jun 2002 11:34:38 -0400
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Problem with macro :(
... I think it might be nearly what it shold be, but in the
%if (i>2) ....
you forgot the &
%if &i>2 %then ....
might do what you want. I'm not sure, because I don't know what you want, I
only see what you did!
A good method to see if that is really that what you want:
decrease your counter from 2000 to 5 and activate the option MPRINT. That
will show you, what is generated and you'll see if that is really what you
wanted.
On Tue, 18 Jun 2002 17:27:02 +0200, Jim Groeneveld
<J.Groeneveld@ITGROUPS.COM> wrote:
>Hi Pawel,
>
>You are mixing two different languages: the SAS language and the SAS macro
>language in code that handles your data. Remember: macro language never
>handles your data (directly): it acts like a program generator, it
generates
>SAS code, which in its turn handles the data. Do study the macro language a
>little more before trying to apply it; it is quite complicated in the
>beginning, I know from when I learned it.
>
>Regards - Jim.
>--
>Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070
>senior statist./data man. P.O. Box 1 fax. +31 412 407 080
>J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com
>
>Computers aren't there to be kept busy, but to keep us busy.
>
>Notice of confidentiality: this e-mail may contain confidential information
>intended for the addressed recipient only.
>If you have received this e-mail in error please delete this e-mail and
>please notify the sender so that proper delivery
>can be arranged.
>
>> -----Original Message-----
>> From: Pawel Manowiecki [SMTP:pawel.manowiecki@WP.PL]
>> Sent: Tuesday, June 18, 2002 2:20 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Problem with macro :(
>>
>> I make ma macro to generate ARMA(2,2) series.
>> And something dont want to work :(
>> output statement is not valid in macro clause.
>> Without macro clause it works :)
>>
>> Please help me !
>>
>> Thx
>> Pawel Manowiecki
>>
>> -------------------------------------------------------------------------
-
>>
>> %macro Generate_Arma_Series(a1=,a2=,b1=,b2=);
>>
>> data Arma_Series;
>>
>> %do i=1 %to 2000;
>> %if (i=1) %then y=rannor(0);
>> %if (i=2) %then y=rannor(0);
>> y1=lag(y);
>> y2=lag(y1);
>>
>> e=rannor(0);
>> e1=lag(e);
>> e2=lag(e1);
>>
>> %if (i>2) %then y=&a1*y1+&a2*y2+&b1*e1+&b2*e2+e;
>> output;
>>
>> %end;
>>
>> run;
>>
>> %mend Generate_Arma_Series;
>>
>> %Generate_Arma_Series(a1=0.1,a2=0.1,b1=0.1,b2=0.1);
>> ----------------------------------------------------------------
|