Dear all,
I need to assign a dummy variable equal to one if a particular person has made at least one trade in each of the two preceding years. I tried several approaches, but with no luck.
Here's a chunk of my dataset:
I would really appreciate any help!
Cheers
I need to assign a dummy variable equal to one if a particular person has made at least one trade in each of the two preceding years. I tried several approaches, but with no luck.
Here's a chunk of my dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long personid double(permno tprice) float month 12058108 76892 16.5 482 12058108 76892 31.75 499 12058108 76892 31.25 502 12058108 76892 34.15 508 12058108 76892 36.5 521 12058108 76892 39 526 12058108 76892 39.03 527 12058108 76892 40.02 529 12058108 76892 40.58 530 12058108 76892 41.75 531 12058108 76892 46.35 538 12058108 76892 48.03 539 12058108 76892 47.1 540 12058108 76892 42.64 544 12058108 76892 43.44 550 12058108 76892 47.29 551 12058108 76892 44.83 553 12058108 76892 50.34 562 12058108 76892 53.162 563 12058108 76892 53.61 568 12058108 76892 52.6819 573 12058108 76892 52.89 574 12058108 76892 53.31 575 end format %tmMon_CCYY month
Cheers
Comment