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

st: predicitng year by year values


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   st: predicitng year by year values
Date   Mon, 12 Jan 2004 18:37:42 -0000

How can I regress several cross-sections, predict the values by year and
amend them into the main dataset?

I have an unbalanced panel and I want to run a regression for each year:

bys year reg y x

The point is to save the y-hat (predicted values) emanated from the year by
year regressions into a single column. I tried the -foreach- command put
apparently there is a problem with the syntax:

foreach num of local year {
reg y(num) x
predict y(num)
}

Many thanks,

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