LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 20 Jan 2006 08:44:33 -0500
Reply-To:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "SASsy :-)" <sas__l@HOTMAIL.COM>
Subject:   Re: AR(p) simulation program

Hi, didn't test it or anything, but why both the parameter "b" and the global var "rho" ? Skip that attempted link and type'em directly:

%macro arsim(table=temp,n=1000,a=0,b=0.8 0.64 0.5 0.7 ,sig=1,seed=1); %let Count = %eval( %length(&b) - %length (%sysfunc( compress(&b))) + 1 ) ; %*more code; %put &b ; %put &count; %mend; %arsim;

s

On Fri, 20 Jan 2006 13:16:48 Z, Dirk Nachbar <Dirk.Nachbar@DWP.GSI.GOV.UK> wrote:

>dear all > >previously I asked how to simulate AR processes in SAS. I have written a macro >which should do any AR(p) process. Unfortunately there are some errors. SAS >doesn't like the reverse loop with the %eval function. Also SAS seperates my >rho parameters by the dot. How can I prevent that? > >options mprint mlogic; >*the AR parameters; >%let rho=0.8 0.64 0.5 0.7; >*a=constant, sig is coefficient for error variance; >%macro arsim(table=temp,n=1000,a=0,b=&rho,sig=1,seed=1); >%let Count = %eval( %length(&b) - %length( %sysfunc( compress(&b) ) ) + 1 ) ; > >data &table; >retain > %do i=1 %to &count; > y&i > %end; >0; >do t= -&count to &n; > y= &a > %do i=1 %to &count; > + %scan(&b,&i)*y&i > %end; > +&sig*normal(&seed); > if (t > 0) then output; > %do i=&count %to 2 by -1; > y&i=y%eval(&i-1); > %end; > y1=y; >end; >run; >%mend; > >%arsim(table=temp,n=100,a=1,b=&rho,sig=1,seed=1) >proc reg; >model y=y1-y4; >quit; > > >Dirk Nachbar >Assistant Economist >Pensim2 >Department for Work and Pensions >Level 4, The Adelphi >1-11 John Adam St >WC2N 6HT London >020 796 28531 >********************************************************************** >This document is strictly confidential and is intended only for use by the addressee. >If you are not the intended recipient, any disclosure, copying, distribution or other >action taken in reliance of the information contained in this e-mail is strictly prohibited. >Any views expressed by the sender of this message are not necessarily those of the Department >for Work and Pensions. >If you have received this transmission in error, please use the reply function to tell us >and then permanently delete what you have received. >Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance >with our policy on the use of electronic communications. >********************************************************************** > > > >The original of this email was scanned for viruses by the Government Secure Intranet (GSi) virus scanning service supplied exclusively by Cable & Wireless in partnership with MessageLabs. > >On leaving the GSi this email was certified virus-free


Back to: Top of message | Previous page | Main SAS-L page