I have got the following problem:
I am trying to sort my variable into five quintiles and within each quintile I sort another variable into five more quintiles. This results in 5x5 portfolios.
This is the dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(lRsqu alphatl)
. .
.8492597 -.6673416
.8437587 -2.3389862
.8452843 .30016315
.8601297 .3724269
.8691546 .6786571
.8841668 2.2653832
.8876752 -2.2238657
.8821524 .55729717
.9283358 2.06477
.9538744 -3.1534085
.9451784 2.8826375
.9375255 3.282628
.9333589 -1.5626493
.9386432 -2.5049946
.93699 2.0213053
.9399988 2.2347538
.943158 -2.518438
.9339849 2.5404644
.9373132 .3698889
.9379639 1.414377
.9389971 -1.9083146
.9385521 1.230852
.9404954 -.7030577
.9416158 -.165016
.9440844 .12624428
.9433135 -.2099296
.9453504 -.9947472
.9473855 -1.3289968
.9482979 -2.582619
.945869 1.3279735
.9477227 1.1662924
.9470893 2.806799
.951561 1.9293336
.9452592 1.507581
.9410356 -1.888088
. .
.84052 -4.5013776
.7640013 -1.230109
. .
.7953995 -1.84165
.763701 -2.5651925
. .
.8122256 3.357514
.9708027 -.6237252
.9633558 -2.976884
.9508489 -1.888965
.9571319 -1.902355
.9628463 .8699767
.9585466 -.3966509
.9598147 -2.914656
.9601157 -2.044562
.9610327 -9.798227
.9082741 4.1743417
.9240623 .8981467
.9242032 4.6243277
.9056889 1.9300214
.9081386 -.04775813
.9095054 .7978305
.9122971 3.5095186
.9035737 -1.811179
.8933021 .5289839
. .
.9745287 -1.908935
.9745261 2.902449
.9532403 -1.4459622
.9426749 -3.514782
.9116024 -.12026531
.9143506 .3338297
.9144306 1.766378
.9275297 .05470944
.9279215 -.4787422
.9285604 -2.0074744
.9067073 3.1798935
.8383521 1.9512254
.817727 -.1964305
.8458316 1.281453
.8398812 1.4092634
.8375641 -.8212233
.8471023 -.5335991
.8469019 1.2763717
.8445817 2.0106041
.8301534 .2856706
.8491577 .8858739
.8496809 -.438701
.8459197 .7877609
.8365584 1.344182
.8241314 -1.490751
.8412024 .894092
.852065 1.639639
.8442533 .8743293
.8544524 -.26318347
.8795037 .030096546
.882191 -1.814595
.8709548 -.4207301
.8442778 1.1605158
.84082 -.9981863
.8395051 -.12342247
.8713467 -.6070057
.8986678 -1.0313703
end
Code:
by calmt, sort: egen quantileRsqu = xtile(lRsqu), n(5) by calmt quantileRsqu, sort: egen quantileA =xtile(alphatl), n(5)
Thanks in advance

0 Response to Double Sorting quantiles
Post a Comment