My actual dataset is large so i am posting an example here.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte firm float(var1 da) 1 .3440065 .47212315 1 .8086346 .071356334 1 .7810416 .58836746 1 .59249973 -.5805435 1 .763523 .4240699 2 .58147943 .6231582 2 .4374028 .29705063 2 .22375245 .8810358 2 .4670937 -.8361621 2 .329619 .28815654 2 .3748362 .17793214 3 .7174032 .8677467 3 .6616882 -.3164898 3 .7876359 .3057091 3 .8956375 .7337653 3 .7788198 .5092093 4 .9330595 .13902761 4 .009004894 .342617 4 .671393 -.8709255 4 .4765641 .896404 4 .9045753 .03744958 5 .7953129 .436842 5 .4977751 .4488074 5 .01935726 .7797458 5 .53233165 .1224825 5 .08152536 .874486 6 .3793468 -.5277116 6 .56820965 .22691797 6 .04368795 .3986916 7 .913205 .4714641 7 .9004316 .7407852 7 .7772265 -.6351842 7 .5769991 .13843548 7 .16265187 .27961093 7 .5061803 -.8985645 end
I want to divide the firms into tertiles in such a way that the Firms with high values of DA lie in upper tertile while Firms with low values of DA lie in the lower tertile. Moreover, the number of firms are not a multiple of 3.
I used the code.
xtile tda=da,nq(3)
this command divides the dataset BUT the problem is that the firms are appearing in the upper as well as in lower tertiles. They should appear only once i.e; either in the upper tertile or in the lower tertile.
My Question
How can i solve this problem?
After dividing the dataset i also want to regress 'da' on var1 in the corresponding tertile.
Thanks in Advance
Kind Regards
Azhar Mughal
0 Response to Dividing the dataset into tertiles
Post a Comment