Hello Statalist,
I am using the Asdocx Crosstab command to create 5x5 groups based on two variables (size and book-to-market), resulting in a 5x5 table showing the average return of the specified variables for each group (an example of the table below). Now, I want to report the t-statistics below each displayed means in the table, but I haven't found a solution yet. Please, I need your help.
I am using the Asdocx Crosstab command to create 5x5 groups based on two variables (size and book-to-market), resulting in a 5x5 table showing the average return of the specified variables for each group (an example of the table below). Now, I want to report the t-statistics below each displayed means in the table, but I haven't found a solution yet. Please, I need your help.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float time_avail_m double permno float(xret BM mve_c) double(bm5 sz5) 720 81624 .18959592 .52959126 28.770817 4 1 720 13121 .52168196 .016941331 74.52807 1 1 720 10777 -.011427608 .666784 5070.116 4 4 720 12994 .09879677 .311409 21430.344 3 5 720 14159 -.034572903 .08099528 3453.102 2 4 720 84757 .53541434 .23684376 11.75217 3 1 720 10781 .015739387 .4831078 105.623 4 1 720 72304 -.04480295 .12086964 1507.812 2 3 720 15508 .025972744 1.401705 122.49765 5 1 720 77235 -.0852161 .6220048 27.903 4 1 720 83885 -.0985223 .016941331 81.77195 1 1 720 78916 -.02499618 . 61269.62 . 5 720 75714 .1914711 .8474119 32.96898 5 1 720 14296 -.14803594 .04770321 172.5136 1 2 720 10909 -.02255627 .0933625 22406.51 2 5 720 62308 -.0090672 .6825542 11290.107 4 5 720 89424 -.1151561 .9702739 105.69075 5 1 720 63467 .13598475 .016941331 12646.31 1 5 720 92635 .03617069 .12538192 586.2307 2 3 720 76185 .07756142 .04448668 12618.988 1 5 720 13751 .02467794 3.213769 5.25973 5 1 720 15273 -.2413 .01709463 6.4657 1 1 720 93393 .1192821 .02984881 324.7744 1 2 720 88620 -.04043582 .1246609 75.71769 2 1 720 90808 .001566632 . 14582.837 . 5 720 87318 -.0981538 .7798908 1452.6317 5 3 720 11285 -.11229976 .54731786 1050.2434 4 3 720 16451 -.18300107 .016941331 1138.9233 1 3 720 93397 .013780652 .5460218 348.5882 4 2 720 11397 -.12139665 .4964933 821.7908 4 3 720 16497 -.3109774 . 906.8764 . 3 720 87302 .0773331 .58536124 19.55387 4 1 720 11369 -.11407808 .484646 3483.782 4 4 720 27887 .0656696 .0788638 45551.81 2 5 720 13203 -.0975444 .9181375 106.2991 5 1 720 90829 -.15756315 .03851551 8758.161 1 5 720 90219 -.09070854 .7047859 1424.955 4 3 720 84819 .05695249 .08355383 3.93708 2 1 720 16989 -.02385802 .05946761 768.0874 2 3 720 89393 .06520799 .05361585 151427.9 1 5 720 59256 .031220295 .5979067 64.56045 4 1 720 91176 -.006194014 .9362959 90.341 5 1 720 82777 -.06055833 .21408844 3076.696 3 4 720 10220 .023023427 .016941331 6056.948 1 4 720 88196 -.03110212 .8337812 2651.753 5 4 720 83969 .005320258 .8750415 357.1639 5 2 720 76127 -.2206878 .05603124 192.07773 2 2 720 66384 .03856133 .016941331 19584.5 1 5 720 10104 -.006773741 .016941331 168241.2 1 5 720 13940 -.3811821 .07131244 996.6608 2 3 720 14593 .05270993 .09398752 1354255 2 5 720 13911 .00348937 . 30124.4 . 5 720 78223 .0021085227 .3800615 14827.527 3 5 720 16158 -.066746496 1.766256 584.7624 5 3 720 90120 -.06617149 1.447506 4372.7236 5 4 720 86783 -.10997053 .016941331 75815.89 1 5 720 79909 .12678134 1.0006652 1249.2677 5 3 720 91348 -.02032745 .05478552 427.344 2 2 720 88970 -.06524012 .8256305 203.125 5 2 720 82686 .0917568 .02820966 15766.722 1 5 720 29102 -.28255007 1.55709 752.2711 5 3 720 14983 .03554845 .02308419 6161.524 1 4 720 13863 -.07154796 .04813665 611.2867 1 3 720 16818 -.20672083 .2047634 183.5371 3 2 720 14166 .2298199 .021879004 799.6041 1 3 720 15302 .04247741 .016941331 1973.7094 1 4 720 13825 -.1670494 .3132261 1026.8829 3 3 720 15295 .21926673 .3008919 1699.7775 3 3 720 88837 -.007552569 .2766958 18487.008 3 5 720 86211 .064604744 .45336905 1228.5544 4 3 720 91408 .002556552 .8505644 79.00105 5 1 720 80828 -.07455616 .6920553 392.274 4 2 720 90011 -.06570896 .12368165 1802.6498 2 3 720 13921 -.10335797 1.274709 669.985 5 3 720 14711 .034736 1.5768657 43.0629 5 1 720 89297 .07649978 .04873028 3323.141 1 4 720 13797 .11679368 1.4101962 258.26044 5 2 720 16820 .53541434 .07927047 56.53818 2 1 720 88197 -.05637751 .6253492 2704.374 4 4 720 79490 -.03413579 .4633842 87.72624 4 1 720 17106 .1065844 .1191441 1320.5656 2 3 720 49154 -.13756089 .25182047 56116.05 3 5 720 12082 .003066829 .18682145 1433.406 3 3 720 14149 -.15809128 . 606.5965 . 3 720 12639 .002969855 .016941331 3589.0344 1 4 720 46886 -.07106479 .016941331 25983.39 1 5 720 58421 -.022961156 1.6757364 41.08133 5 1 720 14653 -.07222199 .6913872 546.0408 4 3 720 89968 .029848333 .57116777 1129.291 4 3 720 76788 .06259782 .016941331 1042.3583 1 3 720 88384 -.02455577 1.282194 71.41932 5 1 720 57154 -.08162779 .4458608 737.6558 4 3 720 64936 .03407793 .3333466 70580.23 3 5 720 12650 .10009722 .1661654 16219.713 2 5 720 22779 .09712373 .094402 30326.47 2 5 720 92314 -.1158251 .24395257 184.36244 3 2 720 10158 .09527146 .8493639 557.1433 5 3 720 44206 .08533457 .333734 29928.467 3 5 720 90199 -.005215838 .06168788 20436.61 2 5 720 81254 -.02526072 .6746739 919.1231 4 3 end format %tm time_avail_m label values bm5 bmlabel label def bmlabel 1 "Low", modify label def bmlabel 2 "2", modify label def bmlabel 3 "3", modify label def bmlabel 4 "4", modify label def bmlabel 5 "High", modify label values sz5 szlabel label def szlabel 1 "Small", modify label def szlabel 2 "2", modify label def szlabel 3 "3", modify label def szlabel 4 "4", modify label def szlabel 5 "Large", modify
Code:
* First create 5 groups of size and book-to-market in each year bys time_avail_m: astile bm5 = BM, nq(5) bys time_avail_m: astile sz5 = mve_c, nq(5) * Assign value and variable labels for better readability label define bmlabel 1 "Low" 2 "2" 3 "3" 4 "4" 5 "High" label values bm5 bmlabel label var bm5 "Book-to-market" * similarly assign labels to the size variable label define szlabel 1 "Small" 2 "2" 3 "3" 4 "4" 5 "Large" label values sz5 szlabel label var sz5 "Size" *Report size in rows and BM in rows, use mve_c as a weighting variable asdocx crosstab sz5 bm5, ret(xret) time(time_avail_m) weight(mve_c) /// title(Table 1: Average Returns of Portfolios, by size and book-to-market)