Hi All
I am a beginner with Stata and am working with analyst data downloaded from IBES. I am using Stata to compute the dispersion of forecasts made by analysts over a certain period. The formula that I need to calculate is as follows:
Std Dev of earnings forecasts issued by individual analysts in year t/ Stock price of year t-1
I have used the following Stata code to do the above computation:
gen fyear=year(fpedats)
gen fmonth=month(fpedats)
gen year_actual=year(anndats_act)
gen month_actual=month(anndats_act)
sort ticker fyear analys fpedats
gen date=anndats_act-anndats
sort ticker fyear analys fpedats date
by ticker fyear analys fpedats: gen n=_n
keep if n==1 (deleting multiple forecasts from one analyst in a year)
sort ticker fyear (fpedats)
by ticker fyear: gen analyst_num=_N
sort ticker fyear (fpedats)
by ticker fyear: egen std_forecast_full=sd(value)
With the above code, I hope to compute the 1st part of my formula, that is std dev of forecasts issued by individual analysts. However, the mean of this final column (std_forecast_full) is very high like 1234.56 etc. I think this is not right.
Can someone please point what is wrong with above code? Can someone also tell what would be the code to divide this column with stock price from last year?
Thank you so much for the help! Please let me know shall further information be required.
Related Posts with Analyst Forecast Dispersion
problem with looping the command tabstatHell everyone, I want to observe the sd and mean of each of the countries in my panel dataset seper…
graphical markersDear All, I have this graph Code: * Example generated by -dataex-. To install: ssc install dataex c…
Saving beta coefficients, constant and residuals from linear regression models? Is this code correct?Hi, I am trying to save beta coefficients, constant and residuals and need advice if the following p…
Continuous data with lots of zerosHello I want to analyse a dependent variable (donations) as a function of some variables. The donat…
Year dummys and age in Anderson-Hsiao first differenced modelDear Stata forum! I´m writing a thesis on the causal mechanism of health and socioeconomic position…
Subscribe to:
Post Comments (Atom)
0 Response to Analyst Forecast Dispersion
Post a Comment