Hi!
I am writing my master thesis and I base part of my research on a certain paper.
In the paper, the authors mention that they "define the IBES forecast as the median of forecasts made in the first month after the announcement of realized earnings for the current period".
Since I have to compare the forecast date with the previous earnings announcement date, I am trying to lag the earnings announcement date.
My data looks as following:
Compid is the ID I gave to a specific company to later convert my data into panel data.
Period is the forecast period, whereas a jump from 1 -> 2 means a quarter advance.
input str6 ticker str8 cusip str6 oftic str16 cname double analyst str4 measure double value long(fpedats anndats) str8 anntims long actualdate double Avalue float(compid period)
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .3 19813 19791 "17:05:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .35 19813 19792 "06:48:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .37 19813 19792 "00:25:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 50789 "EPS" .23 19813 19792 "07:45:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .41 19813 19799 "20:05:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .58 19813 19799 "23:44:00" 19849 .12 1 1
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .12 19904 19850 "17:45:00" 19941 .27 1 2
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .29 19996 19942 "16:05:00" 20031 .26 1 3
"0000" "87482X10" "TLMR" "TALMER BANCORP" 50789 "EPS" .28 19996 19942 "16:56:00" 20031 .26 1 3
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .25 19996 19942 "14:53:00" 20031 .26 1 3
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .26 19996 19943 "00:15:00" 20031 .26 1 3
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .17 19996 19950 "00:15:00" 20031 .26 1 3
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .16 20088 20032 "14:42:00" 20118 .16 1 4
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .19 20088 20032 "15:36:00" 20118 .16 1 4
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .18 20088 20032 "14:13:00" 20118 .16 1 4
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .17 20088 20033 "00:15:00" 20118 .16 1 4
"0000" "87482X10" "TLMR" "TALMER BANCORP" 72481 "EPS" .16 20088 20060 "07:36:00" 20118 .16 1 4
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .16 20178 20121 "15:55:00" 20208 .12 1 5
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .18 20178 20121 "14:17:00" 20208 .12 1 5
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .17 20178 20121 "16:10:00" 20208 .12 1 5
"0000" "87482X10" "TLMR" "TALMER BANCORP" 72481 "EPS" .17 20178 20121 "15:24:00" 20208 .12 1 5
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .2 20178 20142 "21:15:00" 20208 .12 1 5
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .2 20269 20208 "17:45:00" 20299 .23 1 6
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .22 20269 20208 "15:40:00" 20299 .23 1 6
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .22 20269 20208 "15:47:00" 20299 .23 1 6
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .23 20361 20299 "14:41:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 72481 "EPS" .22 20361 20299 "15:55:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 8675 "EPS" .24 20361 20304 "08:02:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .24 20361 20326 "09:03:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .23 20361 20326 "13:32:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 8675 "EPS" .25 20361 20326 "14:50:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .26 20361 20359 "00:16:00" 20389 .27 1 7
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .26 20453 20390 "13:07:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .26 20453 20390 "15:37:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .27 20453 20390 "17:15:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 603896 "EPS" .26 20453 20391 "00:18:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 8675 "EPS" .26 20453 20391 "08:02:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .27 20453 20450 "21:30:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .12 20453 20451 "00:16:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .3 20453 20451 "13:00:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 8675 "EPS" .11 20453 20451 "11:21:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 72481 "EPS" .27 20453 20451 "12:04:00" 20479 .4 1 8
"0000" "87482X10" "TLMR" "TALMER BANCORP" 538750 "EPS" .28 20544 20479 "21:44:00" 20571 .28 1 9
"0000" "87482X10" "TLMR" "TALMER BANCORP" 548311 "EPS" .28 20544 20480 "05:07:00" 20571 .28 1 9
"0000" "87482X10" "TLMR" "TALMER BANCORP" 80474 "EPS" .31 20635 20572 "07:00:00" 20662 .28 1 10
"0000" "87482X10" "TLMR" "TALMER BANCORP" 8675 "EPS" .32 20635 20577 "08:04:00" 20662 .28 1 10
My point it:
I am trying to get my data as following:
For period 1, I will need the lagged announcement data, but since there is none reported that should end up as "."
For all observations with period=2, I will need the lagged announcement data of period=1, thus "19849" in code language (actually 06may2014)
For all observations with period=3, I will need the lagged announcement data of period=2, thus "19941" in code language (actually 06aug2014)
How can I do this? I tried:
by compid: gen lagdate=actualdate[period-1]
or
by compid fpedats: gen lagdate1=actualdate[period-1]
followed by
format lagdate1 %td ddMonyy
But none of those options gets me what I want. I use STATA/SE 15.0
Thank you in advance!
Related Posts with Lagging Date Varlist by one period for all observations within the period.
Get name of specific variable which name is equal to another value of a variableI have a study where I am to look 28 days back in time before an event to see if the patients were w…
Stata dropping interacting Time Period Covariates. Can't figure out why.Good Morning. I am trying to run a simple descriptive regression on a year-district (1964-2002, ~40…
IV estimation (2SLS) with slope dummy variable interacting with endogenous variable.Hi, I want to estimate a regression with a dummy variable, say D. My dependent variable is Y. My exo…
Logit & conformability error in inteff I am using a survey data to run a logit regression, and currently I am testing the interactions of …
Instrumental variable analysis with multiple imputationHello all, I will please like to find out if IV analysis works with imputed data (i.e using multipl…
Subscribe to:
Post Comments (Atom)
0 Response to Lagging Date Varlist by one period for all observations within the period.
Post a Comment