Hi,
I have a panel data with securities (id) and month (ymdate), return (ex_ret) and market cap (mcap in $m) etc. Now I want to only keep securities that has initial mcap > $10 (first observation in data set). If it starts above $10 and goes below $10 at a later point in time, I still want to keep them in my data set.
Any suggestion/help is much appreciated. I have included a snapshot of data.
Thanks,
John
I have a panel data with securities (id) and month (ymdate), return (ex_ret) and market cap (mcap in $m) etc. Now I want to only keep securities that has initial mcap > $10 (first observation in data set). If it starts above $10 and goes below $10 at a later point in time, I still want to keep them in my data set.
Any suggestion/help is much appreciated. I have included a snapshot of data.
Thanks,
John
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id float(ex_ret ymdate) int year byte month float mcap 5 .007135526 408 1994 1 95.32637 5 .04686265 409 1994 2 111.5997 5 -.0521462 410 1994 3 120.20005 5 -.0205943 411 1994 4 118.55016 5 -.03191356 412 1994 5 115.30073 5 .0003904014 413 1994 6 108.75031 5 .02415652 414 1994 7 112.24284 5 .05768865 415 1994 8 119.38356 5 .006272078 416 1994 9 123.8092 5 -.04605908 417 1994 10 127.4961 5 -.033803094 418 1994 11 125.62856 5 -.07200204 419 1994 12 115.3449 5 -.08217537 420 1995 1 103.74718 5 -.04307023 421 1995 2 95.07434 5 -.09054957 422 1995 3 78.60113 5 .016433334 423 1995 4 75.64328 5 -.006503144 424 1995 5 69.77741 5 -.00028255107 425 1995 6 62.30355 5 .004845794 426 1995 7 59.46569 5 -.0335671 427 1995 8 54.49944 5 -.0043 428 1995 9 46.45511 5 -.05573758 429 1995 10 44.24756 5 -.08221418 430 1995 11 36.724445 5 .002151282 431 1995 12 33.28134 5 -.0004807766 432 1996 1 30.08087 5 -.008338808 433 1996 2 26.936356 5 -.07077898 434 1996 3 22.63101 5 -.019309897 435 1996 4 12.20499 5 -.03222314 436 1996 5 11.884175 5 .09798147 437 1996 6 8.665211 5 -.05694231 438 1996 7 8.209953 5 -.05392935 439 1996 8 4.001592 11 .0594 408 1994 1 . 11 -.0275 409 1994 2 . 11 -.0164 410 1994 3 . 11 -.004 411 1994 4 . 11 .0343 412 1994 5 . 11 .0201 413 1994 6 . 11 -.0155 414 1994 7 15.9 11 .0049 415 1994 8 . 11 -.0037 416 1994 9 . 11 -.0195 417 1994 10 . 11 -.0149 418 1994 11 . 11 -.0192 419 1994 12 . 11 .0007 420 1995 1 . 11 .0028 421 1995 2 . 11 .0154 422 1995 3 . 11 .0173 423 1995 4 . 12 .0415 410 1994 3 14.923252 12 -.0003 413 1994 6 16.368946 12 .026 416 1994 9 19.79441 12 .0133 419 1994 12 21.1824 12 .0387 422 1995 3 22.145514 12 .035 425 1995 6 25.975367 12 .0199 428 1995 9 . 12 .0299 431 1995 12 60 12 .0268 434 1996 3 61 12 .0262 437 1996 6 80 12 .0133 440 1996 9 83 12 .0221 443 1996 12 87 12 .0367 446 1997 3 80 12 .0352 449 1997 6 90 12 .0304 452 1997 9 96 12 .0226 455 1997 12 118 12 .037 458 1998 3 151 13 -.0697 410 1994 3 . 13 .0959 413 1994 6 . 13 .3213 416 1994 9 28 13 .0076 419 1994 12 . 13 .1414 422 1995 3 31 13 .0933 425 1995 6 33 13 .0477 428 1995 9 . 13 .0561 431 1995 12 38.1 13 .1641 434 1996 3 . 13 -.021 437 1996 6 . 13 .0136 440 1996 9 30 13 -.0556 443 1996 12 40 13 .0457 446 1997 3 . 13 .1803 449 1997 6 . 13 .1296 452 1997 9 . 13 .0152 455 1997 12 . 13 .3681 458 1998 3 . 13 .0609 461 1998 6 . 13 .0394 464 1998 9 . 13 .3012 467 1998 12 106 13 .05 470 1999 3 110 14 .0058 408 1994 1 . 14 -.0007 409 1994 2 . 14 -.0467 410 1994 3 . 14 -.0216 411 1994 4 . 14 -.0244 412 1994 5 . 14 -.0195 413 1994 6 . 14 .0118 414 1994 7 . 14 .0009 415 1994 8 . 14 -.0066 416 1994 9 2 15 .0241 408 1994 1 18.121399 15 .0391 409 1994 2 19.069885 15 .0031 410 1994 3 19.21628 15 .0216 411 1994 4 20.59685 15 .0094 412 1994 5 20.934223 end format %tm ymdate
Comment