我已经将数据按照年份和Size排序,请问如何对每年的样本选取Size的前33%和后33%,并且对前33%的样本生成新变量FC=0,对后33%的样本生成新变量FC=1?
求各位前辈/老师帮助!!
* Example generated by -dataex-. To install: ssc install dataex
clear
input long company_id int year double(Size Lev) float t
555 2000 18.556068340551374 .10316 1
1696 2000 18.687652847007094 .829392 2
669 2000 18.748225365387697 .478365 3
600711 2000 18.806919196956517 .414654 4
600792 2000 18.895319391323852 .394613 5
600647 2000 18.932149024170453 .937293 6
805 2000 19.02626198252539 .596529 7
38 2000 19.032833159684486 .263643 8
639 2000 19.057714121858417 .577388 9
600847 2000 19.106562240238496 .504027 10
600883 2000 19.119669916399022 .302143 11
600749 2000 19.1340881070161 .452429 12
600763 2000 19.138882770073764 .024731 13
556 2000 19.149733148124348 2.072143 14
600239 2000 19.18522884609796 .139241 15
526 2000 19.242419604149898 .283264 16
838 2000 19.25264233163944 .883305 17
600768 2000 19.27189561085761 .651948 18
600765 2000 19.28774649124239 .233147 19
600858 2000 19.296482225857325 .379238 20
600691 2000 19.314688612565636 .587386 21
600892 2000 19.318648409040673 .565322 22
801 2000 19.319419923538764 .273001 23
600791 2000 19.34652568185637 .5431 24
600759 2000 19.34666702745394 2.89368 25
603 2000 19.372985389613607 .49471 26
518 2000 19.43108964186464 .254263 27
600634 2000 19.437577118756746 .330791 28
671 2000 19.438423373844888 .295428 29
600818 2000 19.443403707455573 2.182731 30
803 2000 19.446455932904627 .474537 31
600743 2000 19.472479707501545 .479067 32
689 2000 19.483929521872184 .835827 33
8 2000 19.488243991424245 .572953 34
411 2000 19.493304814388797 .841119 35
600756 2000 19.511510596840097 .206557 36
600855 2000 19.515820199142293 .39912 37
605 2000 19.522417651510494 .660934 38
65 2000 19.539505607935304 .518383 39
662 2000 19.539558635504694 .766839 40
600703 2000 19.54351485749713 .658256 41
14 2000 19.553436439483498 .874071 42
600670 2000 19.57028518073804 .486434 43
600148 2000 19.58477828368656 .396126 44
409 2000 19.589346698381735 .209153 45
602 2000 19.598611630497473 .641127 46
613 2000 19.60180421301449 .680884 47
600840 2000 19.60744521293259 .475453 48
810 2000 19.618782632679988 .48912 49
710 2000 19.621814016852063 .377056 50
600714 2000 19.622368873655667 .404587 51
600673 2000 19.64173795213849 .614986 52
545 2000 19.6463428579342 .5213 53
600721 2000 19.664612039206617 .624102 54
10 2000 19.678522018283065 .525425 55
606 2000 19.690959078419905 .243405 56
600118 2000 19.70386275400866 .17267 57
672 2000 19.713872639564833 .648151 58
676 2000 19.721510103654655 .335301 59
835 2000 19.724096368910622 .525991 60
600804 2000 19.726022540788033 .457539 61
658 2000 19.72619438184681 .976906 62
827 2000 19.72778205049336 .541373 63
600794 2000 19.738871020648826 .444256 64
600290 2000 19.74224123701572 .432339 65
536 2000 19.74791925827675 1.092589 66
600687 2000 19.75289378087059 .498533 67
600869 2000 19.753494487156864 .395334 68
600725 2000 19.756906636647468 .090646 69
600782 2000 19.76636736587894 .319809 70
685 2000 19.77653666474304 .258333 71
600773 2000 19.777216034650877 .165361 72
430 2000 19.781478016736152 .709516 73
819 2000 19.78757928078501 .082908 74
600753 2000 19.79365685061178 .75645 75
736 2000 19.795662071669824 .387836 76
546 2000 19.79698538594213 1.235195 77
519 2000 19.800717495282218 .473268 78
600880 2000 19.8035880317602 .469536 79
915 2000 19.80583792625445 .352541 80
600745 2000 19.808360509006892 .775157 81
711 2000 19.81875925970467 .123206 82
600656 2000 19.819789739739363 .619453 83
600671 2000 19.821570833053908 .38089 84
600666 2000 19.82763361974232 .388365 85
532 2000 19.83261468775464 .069116 86
600817 2000 19.838860240345298 .694687 87
600796 2000 19.839081003330215 .381815 88
621 2000 19.842757911472248 .175934 89
600246 2000 19.84293078707694 .294318 90
600070 2000 19.8552846009773 .328283 91
901 2000 19.861815886875313 .260847 92
600625 2000 19.86323963407172 1.119241 93
600735 2000 19.86773389261748 .266735 94
19 2000 19.870210137083753 .320259 95
600247 2000 19.87653050947789 .248666 96
502 2000 19.87661414172619 .385761 97
978 2000 19.878935025336745 .169298 98
600885 2000 19.880105425069097 .683856 99
829 2000 19.88277390497967 .24892 100
689 2001 17.389406010530916 13.582673 1
600763 2001 17.7065801059652 .153074 2
600759 2001 17.88470538491468 7.151806 3
658 2001 17.895506177063243 9.238974 4
600647 2001 18.14400834534221 1.344531 5
8 2001 18.493900723257113 1.321407 6
47 2001 18.68723943932883 6.109422 7
669 2001 18.78420719680668 .477797 8
603 2001 18.833553341542082 .839214 9
600792 2001 18.85631855598768 .542478 10
38 2001 18.93979145732167 .246205 11
600629 2001 18.976093434149124 3.342065 12
653 2001 19.00575268894569 8.064527 13
639 2001 19.008601593740178 .543708 14
1696 2001 19.055003134055376 .851073 15
600749 2001 19.082276504595132 .565935 16
600711 2001 19.088573102852035 .570241 17
600847 2001 19.10412479514334 .551671 18
838 2001 19.151542173710666 .83393 19
600083 2001 19.16112542044469 .993752 20
605 2001 19.165167777698482 .511178 21
801 2001 19.170958215790158 .331974 22
600765 2001 19.177594718460668 .282898 23
613 2001 19.21022889487007 .966618 24
600858 2001 19.216616447987104 .494123 25
4 2001 19.218227600266285 .460723 26
600670 2001 19.221463519219054 .698933 27
600691 2001 19.261216450899603 .598624 28
600892 2001 19.27708993011564 .543945 29
805 2001 19.277293211904663 .578612 30
600743 2001 19.348373750277464 .595037 31
600768 2001 19.39193340773857 .701972 32
409 2001 19.40011657027088 .172461 33
602 2001 19.43548043516704 .315504 34
556 2001 19.45282076310276 .341691 35
803 2001 19.4536344037564 .472499 36
671 2001 19.47514006712656 .357742 37
536 2001 19.49599459476254 1.064454 38
10 2001 19.499886328340434 .436982 39
555 2001 19.50688584362315 .669058 40
600520 2001 19.518039894070238 .259821 41
600855 2001 19.52104221001733 .337586 42
600721 2001 19.56230977276361 .608285 43
546 2001 19.57657649273996 .978702 44
600845 2001 19.58943846728679 .178934 45
600883 2001 19.589483710526363 .20204 46
600831 2001 19.614279511857607 .643847 47
545 2001 19.616435782303032 .567275 48
600673 2001 19.62377872686361 .623283 49
600745 2001 19.62447235075302 .619991 50
514 2001 19.633342039742942 .915792 51
600804 2001 19.648297745609995 .439406 52
600714 2001 19.664245595545843 .373052 53
600756 2001 19.665026476645842 .211865 54
600082 2001 19.676100026804562 .077679 55
600118 2001 19.676812155553645 .155653 56
502 2001 19.679184109994022 .475878 57
430 2001 19.680522850687705 .35329 58
558 2001 19.683493361027857 .52811 59
600148 2001 19.69186174530475 .268792 60
600666 2001 19.693778092456025 .328832 61
710 2001 19.69405995144524 .548047 62
600239 2001 19.73244564793314 .098508 63
600880 2001 19.740047801384137 .365792 64
600633 2001 19.7535663670529 .517108 65
600317 2001 19.77140587520606 .349724 66
18 2001 19.77873078055121 .210731 67
835 2001 19.786065298660922 .525951 68
600097 2001 19.791927666669963 .666926 69
600687 2001 19.79776298652857 .425688 70
535 2001 19.801800900584016 1.732925 71
566 2001 19.806187953674865 1.624086 72
600782 2001 19.809119615365436 .335337 73
19 2001 19.809182676816707 .182292 74
600419 2001 19.815432062412924 .3013 75
586 2001 19.81589425790942 .346083 76
685 2001 19.818828003015117 .236552 77
600146 2001 19.820340751298534 .106044 78
600807 2001 19.8263248288182 .646203 79
600671 2001 19.828603517475617 .384379 80
600613 2001 19.8291953456242 .384224 81
600139 2001 19.83160320155712 .746629 82
600873 2001 19.84382287617803 .483139 83
662 2001 19.843828321641805 .547373 84
673 2001 19.8445974323044 .301966 85
600290 2001 19.851249001334512 .481264 86
810 2001 19.85126680717323 .595131 87
600869 2001 19.859762781034 .503035 88
532 2001 19.865391509700164 .029925 89
609 2001 19.867313595203985 .093023 90
600753 2001 19.871896663724403 .754364 91
600878 2002 17.553383044716064 10.375186 1
600763 2002 17.890790345110283 .246404 2
8 2002 18.072769229323722 1.462868 3
600647 2002 18.29988853618808 1.197234 4
600646 2002 18.38050437201466 6.25532 5
600137 2002 18.472753291108596 5.948341 6
600629 2002 18.75093418675384 3.840638 7
600759 2002 18.78700076102916 1.58839 8
669 2002 18.797553569857975 .461186 9
600749 2002 18.918248270008704 .555033 10
600562 2002 18.92586097493311 .410567 11
838 2002 18.944293593174162 .742645 12
514 2002 18.958775432958397 .297417 13
600847 2002 18.96223697274242 .630974 14
600603 2002 18.97341042066618 4.603427 15
801 2002 19.075633636940015 .419407 16
613 2002 19.092586431261825 .938059 17
603 2002 19.105995364695705 .415196 18
600670 2002 19.11352143229837 .803622 19
600858 2002 19.115668342004604 .640769 20
536 2002 19.117488823088294 .983934 21
30 2002 19.129987047398327 8.502144 22
639 2002 19.14966870983172 .551888 23
600083 2002 19.152774345724072 .935472 24
38 2002 19.168097414577506 .423694 25
605 2002 19.211148327191342 .427941 26
600765 2002 19.215252614675446 .30465 27
409 2002 19.224444273866713 .249013 28
600711 2002 19.226609075038787 .555536 29
555 2002 19.235793083199532 .758945 30
600691 2002 19.246897877302345 .64123 31
526 2002 19.251888570067614 .273397 32
805 2002 19.253424585098752 .520166 33
600743 2002 19.273183402504536 1.018274 34
600538 2002 19.276029508236242 .372783 35
710 2002 19.304848227727895 .550294 36
600831 2002 19.3397219888152 .255756 37
600792 2002 19.36290567202556 .511158 38
4 2002 19.389998769717604 .529541 39
803 2002 19.434551586804815 .445006 40
851 2002 19.48028802838702 .338909 41
600613 2002 19.4837168756792 .495237 42
600768 2002 19.521947305452972 .656749 43
600551 2002 19.536253459853334 .369706 44
600371 2002 19.553140158140636 .175287 45
600673 2002 19.56269672129862 .591989 46
600385 2002 19.571528599076895 .811256 47
600855 2002 19.60243359522886 .326539 48
602 2002 19.639270839366745 .235338 49
600633 2002 19.639786732556516 .410749 50
49 2002 19.639837091039393 .585805 51
600869 2002 19.644330435257736 .622342 52
535 2002 19.644464421069898 2.254703 53
829 2002 19.659300979052993 .196527 54
600496 2002 19.66035586143236 .290801 55
600520 2002 19.671252697354788 .192929 56
600148 2002 19.673419796504607 .239915 57
600239 2002 19.681284846023633 .024831 58
566 2002 19.69320560359208 1.379728 59
412 2002 19.702541001773067 1.076772 60
502 2002 19.71200634853887 .476069 61
600745 2002 19.71507514371994 .601375 62
826 2002 19.715748065715175 .466012 63
600807 2002 19.716757116330378 .76348 64
611 2002 19.718699223151326 .225052 65
545 2002 19.73278989945149 .610084 66
600781 2002 19.735212805802504 .623153 67
600804 2002 19.73823773533481 .47726 68
600671 2002 19.738508317991133 .322129 69
430 2002 19.739890256258924 .399676 70
600892 2002 19.744609478741292 .768871 71
18 2002 19.7462831523954 .180081 72
546 2002 19.75394657946249 .907518 73
600714 2002 19.756676581946195 .387528 74
405 2002 19.762295396136125 1.301759 75
600593 2002 19.762566791243877 .148208 76
809 2002 19.772355563556996 .7168 77
600458 2002 19.77654241182367 .185691 78
1696 2002 19.780307990978642 .86855 79
681 2002 19.78621420219666 .115662 80
552 2002 19.795828436369497 .518427 81
600735 2002 19.799045404409938 .393419 82
672 2002 19.800290760383835 .41422 83
711 2002 19.80030132458267 .225714 84
600139 2002 19.808830642672095 .804752 85
600159 2002 19.816778839710427 1.006603 86
600097 2002 19.830739064768707 .64378 87
600113 2002 19.831525898753142 .080992 88
600791 2002 19.833670856040655 .556916 89
600880 2002 19.838243442700865 .331899 90
600146 2002 19.849974234257992 .109084 91
638 2002 19.860324959156735 1.049286 92
685 2002 19.861947030413834 .247869 93
600557 2002 19.87011949818511 .217547 94
600753 2002 19.879266765487166 .746398 95