I have this dataset
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float modate long gvkey float trn byte tic_newind float ff48_after 432 1043 .011599372 1 1 433 1043 .006463119 0 1 434 1043 .015808247 0 1 381 1056 .03750573 0 0 382 1056 .064970195 0 0 383 1056 .04966758 0 0 384 1056 .06059147 1 1 385 1056 .04347776 0 1 386 1056 .04417698 0 1 405 1056 .10177388 0 0 406 1056 .05430648 0 0 407 1056 .08125668 0 0 408 1056 .18746273 1 1 409 1056 .1538455 0 1 410 1056 .10503364 0 1 417 1056 .018058633 0 0 418 1056 .03559741 0 0 419 1056 .03681609 0 0 420 1056 .030866826 1 1 421 1056 .04697718 0 1 422 1056 .04775205 0 1 441 1056 .04478774 0 0 442 1056 .03789423 0 0 443 1056 .04094375 0 0 444 1056 .06175835 1 1 445 1056 .04464729 0 1 446 1056 .04800224 0 1 513 1056 .17015287 0 0 514 1056 .2357336 0 0 515 1056 .14718385 0 0 516 1056 .1545227 1 1 517 1056 .1759009 0 1 518 1056 .1343986 0 1 528 1082 .0031883584 1 1 529 1082 .000853499 0 1 530 1082 .002583388 0 1 405 1094 .016653419 0 0 406 1094 .04310413 0 0 407 1094 .11329491 0 0 408 1094 .04042383 1 1 409 1094 .05237905 0 1 410 1094 .08144742 0 1 393 1098 .04450803 0 0 394 1098 .07997139 0 0 395 1098 .03759339 0 0 396 1098 .03249086 1 1 397 1098 .04728978 0 1 398 1098 .04178986 0 1 405 1098 .0338261 0 0 406 1098 .05636624 0 0 407 1098 .0397711 0 0 408 1098 .07092672 1 1 409 1098 .03913527 0 1 410 1098 .05148625 0 1 393 1109 .04508612 0 0 394 1109 .03779129 0 0 395 1109 .09138805 0 0 396 1109 .09223603 1 1 397 1109 .13809524 0 1 398 1109 .2015528 0 1 429 1109 .2722 0 0 430 1109 .08326667 0 0 431 1109 .0976 0 0 432 1109 .4278667 1 1 433 1109 .208 0 1 434 1109 .09806667 0 1 417 1117 .04343989 0 0 418 1117 .0807021 0 0 419 1117 .04842126 0 0 420 1117 .05420671 1 1 421 1117 .04526378 0 1 422 1117 .067621104 0 1 369 1173 .016996872 0 0 370 1173 .018456725 0 0 371 1173 .07711157 0 0 372 1173 .027554745 1 1 373 1173 .08824296 0 1 374 1173 .03563608 0 1 381 1173 .09265567 0 0 382 1173 .07543907 0 0 383 1173 .03996807 0 0 384 1173 .028318584 1 1 385 1173 .03065165 0 1 386 1173 .02392062 0 1 477 1228 .08233494 0 0 478 1228 .7436393 0 0 479 1228 .16652174 0 0 480 1228 .10687242 1 1 481 1228 .2338371 0 1 482 1228 .3952275 0 1 561 1228 .05730356 0 0 562 1228 .15050155 0 0 563 1228 .07313765 0 0 564 1228 .2091151 1 1 565 1228 .13381559 0 1 566 1228 .17893605 0 1 453 1239 .04146822 0 0 454 1239 .024712674 0 0 455 1239 .027694177 0 0 456 1239 .035309017 1 1 end format %tm modate
modate = tells me month and year
gvkey = firm identifier
trn = firm turnover
tic_newind= indicator 1 in the month where the firms join a new group
tic_after= indicator equals to 1 the 3 months where the firm joins a new group. 0 the three mon ths before the shift in a new group.
Basically I want to create an event sutdy graph such as
yaxis= average turnover
x axis= -3 month -2 month -1 month +1 month(this is the event study) +2 month +3 month
Since I have to work with average, I would like to have the average for each period (months before and after) and then plotting the graph. So I created these variables
Code:
egen trn_3before= mean(trn) if f3.tic_newind=1 egen trn_2before= mean(trn) if f2.tic_newind=1 egen trn_1before= mean(trn) if f1.tic_newind=1 egen trn_1after= mean(trn) if tic_newind=1 egen trn_2after= mean(trn) if l.tic_newind=1 egen trn_3after= mean(trn) if l2.tic_newind=1
I hope to have not created confusion
0 Response to Event study graph
Post a Comment