I have data as follow (from 04Jan2012 to 31Dec2021)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(date r_AAM r_ACC r_ADC r_BED) 18266 . . . . 18267 .023464635 .018019632 . .031747144 18268 -.01460196 -.03636988 . .024692865 18269 .04879335 -.07696043 . -.018462187 18270 0 -.04082457 . . 18273 -.005621055 0 . . 18274 -.04317229 -.08701079 . -.06187596 18275 0 .0828399 . .03484704 18276 .008784819 . . .05981911 18277 .00581714 . . . 18280 -.05053411 . . . 18281 .03298979 .05406645 . . 18282 -.02388494 . . .05981911 18283 -.02445952 . . .019170104 18284 0 . . . 18287 .009245082 . . . 18288 .03909938 . . . 18289 -.002951047 . . . 18290 -.011911284 . . .066692024 18291 -.027315874 . . -.032790184 18294 .015270777 . . . 18295 .015041084 . . . 18296 0 . . . 18297 .002977435 . . . 18298 -.04255901 . . -.09193846 18301 .02454049 . . -.06108606 18302 -.027651504 . . . 18303 .02461985 . . . 18304 .0030316524 . . .06453909 18305 .003022489 . . . 18315 .012018595 . . . 18316 -.03031186 . . .064022414 18317 0 .015213837 . .030534806 18318 .003078826 -.01905123 . . 18319 0 . . . 18322 .00610959 . . .014388928 18323 .003050709 .01869027 . -.021661734 18324 .009077149 .007377322 . .021661734 18325 0 .09129516 . .06230445 18326 0 .09286636 . . 18329 .03840625 . . . 18330 .04810279 . . . 18331 .019149406 . . .006307384 18332 -.010896324 . . .018692346 18333 .008185525 . . . 18336 -.013683024 .09286636 . . 18337 -.027931724 . . -.025157066 18338 -.008534839 . . -.065813765 18339 .014178528 -.09642832 . .04000565 18340 -.014178528 -.10672422 . -.033225928 18343 -.002867404 .09437885 . . 18344 -.02612636 -.10467136 . . 18345 .01460196 -.1053605 . .01980283 18346 -.029410666 -.10493392 . . 18347 -.0029959874 .17520665 . . 18350 .017804695 .09530683 . -.006644671 18351 -.014808708 . . -.06899347 18352 -.0029959874 . . . 18353 0 . . . 18354 -.0029953 .10897366 . . 18357 0 . . .06021948 18358 0 . . .0462122 18359 .008968723 -.07755852 . .019169083 18360 .008888909 . . . 18361 .008810681 . . . 18364 -.005868317 0 . 0 18365 -.008862676 .04725223 . -.013423044 18366 -.03487077 .08829147 . . 18367 -.009310748 .0863075 . . 18368 .0031132565 .05529019 . .06230335 18371 .015412525 -.073543854 . .0522998 18372 .009130891 0 . .0251587 18373 .01504165 .013074178 . .024541244 18374 -.0029922444 0 . -.05609065 18378 0 .01290214 . -.05942295 18379 0 -.01290214 . .02020378 18380 0 .0256432 . .02631744 18381 0 .01257746 . .0256408 18386 .026584873 -.010049932 . -.006348364 18387 .04838032 .02247124 . -.0522998 18388 .04879016 .03637025 . .0459091 18389 -.035002224 .05781673 . 0 18392 -.04482058 -.034288626 . .006390703 18393 -.0144339 .09531045 . .01265851 18394 -.035510033 -.08374777 . -.05826838 18395 0 -.04706888 . 0 18396 .006011392 .035506207 . -.02020378 18399 .0029922444 -.072319664 . .006780733 18400 -.009003636 .08584152 . -.05557024 18401 -.021309374 -.08655488 . 0 18402 .021309374 -.013794912 . . 18403 -.04938954 -.08398309 . . 18406 .012578953 .097778 . .035090618 18407 -.025318153 -.04196582 . .013698883 18408 .006390422 .028170906 . 0 18409 0 .08515901 . -.013698883 18410 .031354383 .094847 . .03390266 18413 -.015556324 .09509932 . -.06899328 18414 .0031296716 .0945423 . . 18415 .00933266 -.10514814 . . end format %td date
Eg: I want to rank return value of AAM from 04Jan2010-31Jan2010, from 01Feb2010-28Feb2010,....., from 01Dec2021-31Dec2021; Rank value of ACC from 04Jan2010-31Jan2010, from 01Feb2010-28Feb2010,....., from 01Dec2021-31Dec2021, and return value of ADC and BED like that.
I have tried several ways but can't seem to make it work. Can anyone tell me how you would code this?
Many thanks and cheers.
0 Response to How to rank value in each specific date of each firms
Post a Comment