Date: Mon, 15 May 2000 23:58:41 GMT
Reply-To: Dale McLerran <dmclerra@FHCRC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <dmclerra@FHCRC.ORG>
Organization: Fred Hutchinson Cancer Research Center
Subject: Re: Proc pdlreg-Polynomial Distributed lags
Jim,
You can use a macro to fit the various models one at a time, collect
the Akaike IC for the current model, and compare the AIC for the
current model with AIC for the best model. Since the difference
between a couple of models may be small, you may not want to identify
just the "best" model, but print out the results for all models and
generate some text in the log which indicates how the various models
compared. You will need to use ODS to write the table that has the
AIC out to disk. Something like the following:
%macro fit_pdlr(data=, byvars=);
%let AIClist=;
%let i=1;
%let vari=%scan(&byvars,&i);
%do %while(&vari^=%str());
proc pdlreg data=&data;
by &vari;
<model statement>
<ODS control statements>
...
run;
data _null_;
set <ODS table with AIC>;
call symput("AIClist", "&AIClist" || " " || left(AIC));
run;
%let i=%eval(&i + 1);
%let vari=%scan(&byvars,&i);
%end;
%let i=1;
%let vari=%scan(&byvars,&i);
%let AICi=%scan(&AIClist,&i);
%put Akaike Information Criterion for each by variable processed;
%put;
%do %while(&vari^=%str());
%put BYVAR=&vari AIC=&AICi;
%let i=%eval(&i + 1);
%let vari=%scan(&byvars,&i);
%end;
%put;
%put;
%mend;
The macro will generate a table which gives the AIC for each BY variable
processed. I'm still awaiting SAS v8.0, so I don't have all the online
documentation to fill out PDLREG syntax or the ODS statements which
would write out the table which provides AIC. I hope the structure is
clear enough, and you can flesh out those details.
Dale
--------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
Seattle, WA 98109
mailto:dmclerra@fhcrc.org
ph: (206) 667-2926
fax: (206) 667-5977
--------------------------------------
linck@ssb.rochester.edu (Jim Linck) wrote in
<8fpkuo$7l21@biko.cc.rochester.edu>:
>Windows 2000 Prof. SAS v8. Running a polynomial distributed lag model
>with unknown polynomial degree and lag length. Accordingly, I will
>choose some criterion on which to estimate the *best* degree and lag
>length (maybe, for example, the model with the minimum Akaike Info
>Criterion). Since I'm doing this for a large number of samples, I was
>trying to figure out if SAS would do this for me automatically - i.e.,
>run the model, and, for each BY variable separately, use the model with
>the best fit based on the criteria I decide. I can't seem to figure out
>if and/or how to do this. Anyone have any suggestions?
|