Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: forvalues over firms


From   "Danielle H. Ferry" <[email protected]>
To   StataList <[email protected]>
Subject   Re: st: Re: forvalues over firms
Date   Mon, 23 Jun 2003 08:06:45 -0400

On 6/23/03 6:30 AM, "Christopher F Baum" <[email protected]> wrote:

> On Monday, June 23, 2003, at 02:33 AM, Ash wrote:
> 
>> I am trying to run a SUR reg that has many equations.
>> 
>> i.e.
>> 
>> sureg (xret1 xmkt1) (xret2 xmkt2) (xret3 xmkt3) ...
>> (xretN xmktN),
>> corr
>> 
>> Is there a way to form a variable, like "rhs", which
>> can be easily
>> set to equal (xret1 xmkt1) (xret2 xmkt2) (xret3 xmkt3)
>> ... (xretN
>> xmktN) through like a "for loop"?
> 
> * sureg (xret1 xmkt1) (xret2 xmkt2) (xret3 xmkt3) ...(xretN xmktN), corr
> local rhs
> * replace with number of firms
> local nfirm 5
> forv i=1/`nfirm' {
> local rhs "`rhs' (xret`i' xmkt`i')"
> }
> di "`rhs'"
> sureg `rhs',corr
> 
> Note well the lack of an equal sign in the definition of local rhs.
> 
> Kit

Is this so that the local variable <rhs> exists outside of the -forvalue-
loop?



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index