Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How to generate a variable which is different for each cell


From   Peter Peter <[email protected]>
To   [email protected]
Subject   st: How to generate a variable which is different for each cell
Date   Sun, 12 Dec 2010 11:38:50 +0000 (GMT)

Hi Statalisters, 

I have a question which is hard for me to explain, so I will just show you:

Company    Estdate   Estyear    Analyst   Forecast  MEAN  Innovative
AA             Feb, 2.    1984         x             0,68
AA             Sep, 14.  1984         y             0,5
AA             Oct, 15.   1984         z             0,46
AA             Nov, 28.   1984         a             0,76
AA             Nov, 28.   1984         zy           0,54              

I want to generate a dummy variable which becomes 1 if the individual forecast 
is above the mean forecast of all analysts or else 0. 

The commands are:
 
bysort Company Estyear (Estdate): egen MEAN = mean (estdate) 
gen Innovative = 1 if Forecast > MEAN 

So this is pretty simple. But now the mean forecast should only be based on 
forecasts issued 90 days prior. I so far  considered all the forecasts. So each 
Analyst should have his own Mean forecast. How do I solve this Problem? 


Thanks in Advance, 

Peter Biegler



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index