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
confidence intervalmake a projection of the incidence rate of diabetes mellitus during the period 1995−1999, and provid…
Takes forever to run regressionI searched this forum and there were several posts about taking forever to run a specific regression…
Factor variables vs. dummy variables with interactionsHi all, I have a dummy variable x1 (no missing values) in the dataset and has values of 0 and 1, an…
How to convert strings to date variable?For example, a date of 81.511, corresponds to 06/07/1981(DMY). How do you convert this to a Stata da…
Every time I type the command 'mmsel', I get a 'file tmp / xfbf.dta not found' error.I try to implement wage decomposition based on Machado and Mata (2005). I would be grateful if you c…
Subscribe to:
Post Comments (Atom)
0 Response to Analyst Forecast Dispersion
Post a Comment