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

st: Re: forvalues over firms


From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: forvalues over firms
Date   Mon, 23 Jun 2003 06:30:32 -0400

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

*
*   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