| Date: | Thu, 7 Sep 2006 14:19:06 +0000 |
| Reply-To: | toby dunn <tobydunn@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | toby dunn <tobydunn@HOTMAIL.COM> |
| Subject: | Re: Merging Parameter Estimates from several regressions |
|
| In-Reply-To: | <1157609016.688104.226150@m73g2000cwd.googlegroups.com> |
| Content-Type: | text/plain; format=flowed |
|---|
Vladmir ,
It is less ot of the box than you think. It is more in the lines of using
half way descent macro design ( it does one thing and that one thing well
while solving the specific problem that needed to be solved) and knowing
the procedure and ODS to get the desired result in as fewest lines as
possible while maintaining readabilitry and flexability. If I wasnt afraid
the of the US Army national security team coming after me I would post some
of the code that I use for my current project. You find bits along this
same vein in my code.
The statistical viability of this approach while I could comment on it I
feel is better left to those whom specialize in this area like David Cassell
and Peter Flom.
Toby Dunn
When everything is coming at you all at once, your in the wrong lane.
A truly happy person is someone who can smile and enjoy the scenery on a
detour.
From: Vladimir <Vladimir.Oleinikov@GMAIL.COM>
Reply-To: Vladimir <Vladimir.Oleinikov@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Merging Parameter Estimates from several regressions
Date: Wed, 6 Sep 2006 23:03:36 -0700
Toby,
That's what I call a creative and out-of-the-box solution.
Your time is very appreciated.
Regards,
Vladimir
toby dunn wrote:
> Vladimir ,
>
> I dont have SAS right now available to actually test out this code, if I
did
> I would. But let me take you down a totally different path that I think
> simpifys matters:
>
>
> %Macro ModelState( Start = , End = , Model = ) ;
> %Local I ;
>
> %Do I = &Start %To &End ;
> %SysFunc( TranWrd( &Model , # , &I ) ) ;
> %End ;
>
> %Mend ModelState ;
>
>
> ODS OutPut ParameterEstimates = ParametersAll ;
>
> Proc Reg
> Data = MyData ;
> %ModelState( Start = 1 , End = 2 , Model = Model Z# = X# Y# / Vif )
> Run ;
>
> ODS OutPut Close ;
>
>
>
>
>
> Toby Dunn
>
> When everything is coming at you all at once, your in the wrong lane.
>
> A truly happy person is someone who can smile and enjoy the scenery on a
> detour.
>
>
>
>
>
> From: Vladimir <Vladimir.Oleinikov@GMAIL.COM>
> Reply-To: Vladimir <Vladimir.Oleinikov@GMAIL.COM>
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Merging Parameter Estimates from several regressions
> Date: Wed, 6 Sep 2006 07:06:54 -0700
>
> Hello,
>
> I have a data set, which contains returns for a number of stocks
> (denote e.g. z1--z10) and a number of financial ratios (different for
> each stock) to explain the equity returns.
>
> Say x1 and y1 explain z1, x2 and y2 explain z2, ...
> I'd like to get all parameter estimates from corresponding regressions
> in one data set.
>
> As a way of an example, I have tried to proceed as follows:
> *simulate data;
> data work.mydata(drop=seed);
> seed = 39547656;
> do _n_ = 1 to 100;
> x1 = rannor(seed);
> y1 = rannor(seed);
> z1=2*x1+3*y1;
>
> x2 = rannor(seed);
> y2 = rannor(seed);
> z2=5*x2+1.5*y2;
>
> x3 = rannor(seed);
> y3 = rannor(seed);
> z3=7*x3+11*y3;
> output;
> end;
>
> run;
>
> *get parameter estimates;
> %macro CreateParameterDataSet(iAnz);
>
> %do i=1 %to &iAnz;
> ods output ParameterEstimates = work.myparameters;
> proc reg data=work.mydata;
> model z&i= x&i y&i / vif;
> run;
> quit;
> ods output close;
>
> %if i=1 %then %do;
> data work.ParametersAll;
> set work.myparameters;
> run;
> %end;
> %else %do;
> data work.ParametersAll;
> set work.ParametersAll work.myparameters;
> run;
> %end;
> %end;
>
> proc sort data=work.ParametersAll;
> by dependent;
> run;
> %mend CreateParameterDataSet;
>
> %CreateParameterDataSet(3);
>
> The problem is that 'ParametersAll' doesn't get created during the
> first run (i=1) (or rather it gets created but no data from
> 'myparameters' get written into it)
> and I get the following error message:
>
------------------------------------------------------------------------------------------
> ERROR: File WORK.PARAMETERSALL.DATA does not exist.
>
> NOTE: The SAS System stopped processing this step because of errors.
> WARNING: The data set WORK.PARAMETERSALL may be incomplete. When this
> step was stopped there
> were 0 observations and 9 variables.
>
------------------------------------------------------------------------------------------
> I wonder if there's a way to solve the problem.
>
> Regards,
>
> Vladimir
|