Hi,
I am studying analyst expectations and I am looking to calculate forecast errors and forecast revisions. Forecast errors will be actual eps - initial consensus. Forecast revisions will be the difference between the final consensus estimate and the initial consensus estimate.
The initial consensus estimate is the average of the analysts’ most recent estimate (anndats) between the last annual earnings announcement date (anndats_act) and month 6.
The final consensus estimate is the average of the analysts’ most recent estimate between month 7 and the earnings announcement date.
I’m a sas newbie trying to put this together and I’m having difficulty coding for estimates in certain time periods.
I’m able to grab all analyst estimates that take place between the last earnings announcement and June if the earnings announcement takes place in the first half of the year. This is the first part of the below code. However I cannot figure out how to do this if the announcement is in the second half of the year. The second part of the below code will only include estimates between January and June of year t, however I would like to include estimates in t-1 so long as it’s after the last earnings announcement.
data ibex2; set ibesx;
IF month(anndats_act) ge 1 and month (anndats_act) lt 7 then do;
if month(anndats) LT 7;
if month(anndats) gt month(ANNDATS_ACT);
if anndats LT ANNDATS_ACT;end;
else if month(anndats_act) gt 6 and month(anndats_act) le 12
then do;
if month(anndats) LT 7;
if anndats lt anndats_act;end;
run;
My problem is the same but reversed when trying to determine final estimates. If the earnings announcement is in the second half of the year there’s no problem in getting estimates between July and announcement (second part of the below code). But for companies with announcements in the first half of the year I want to include estimates that took place after June t-1 up until announcement date in year t, but I don’t know what type of sas statement this would require. Right now the code below - before the else statement - includes estimates before June t-1, which I don’t require.
data ibesrev3; set ibesx;
IF month(anndats_act) ge 1 and month (anndats_act) lt 7 then do;
if anndats LT ANNDATS_ACT;end;
else if month(anndats_act) gt 6 and month(anndats_act) le 12
then do;
if month(anndats) GT 6 and month(anndats) LE 12;
if year(anndats)=year(anndats_act);
if anndats lt anndats_act;end;
run;
Does anyone have any suggestions on how I should go about tackling this problem?
Thanks very much,
B