Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72762

Median of Analyst forecast earnings

$
0
0
Hi there

I am having problem calculating the median of analyst forecast by year.

The data pattern is like this

FirmID year forecastearning announceyr announcemonth
001 2005 0.12 2005 01
001 2005 0.11 2005 03
001 2005 0.44 2005 06
001 2005 0.33 2005 07
001 2005 0.10 2005 12

I would like to have median of most recent forecast earnings for example, the median should be 0.44, but when i use the following command:
by FirmID year, sort : egen float median = median(forecastearning) if (year== 2005 & announceyr>=2005 & announceyr<2006); it gives me median 0.12.
Although I sort the FirmID year announceyr announcemonth , I still get the same problem.

best regards

​Yahya

Viewing all articles
Browse latest Browse all 72762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>