Hey everyone,
I have to assign a dummy equal to one if a person has traded at least once for three consecutive years.
I recently posted a similar thread: https://www.statalist.org/forums/for...dummy-variable , and Clyde very kind to provide me with an answer:
However, I realized that I have to use a different approach for my study - to assign a dummy if a person has traded for three consecutive years. I tried to alter Clyde's code, but with no luck. I wrote a follow up question on that thread, but I am not sure that it was able reach you. I am sorry for posting again, but these few lines are of great importance for my research. Here's a sample of the dataset that I am using:
I would really appreciate any help! Thank you very much!
Best regards,
Fanetti
I have to assign a dummy equal to one if a person has traded at least once for three consecutive years.
I recently posted a similar thread: https://www.statalist.org/forums/for...dummy-variable , and Clyde very kind to provide me with an answer:
Originally posted by Clyde Schechter
View Post
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long personid double(permno tprice) float(month year) 482 86791 52 481 2000 482 86791 69 484 2000 482 86791 63 485 2000 482 86791 41 523 2003 482 86791 41.06 524 2003 482 86791 40.4 525 2003 482 86791 50 526 2003 482 86791 47.19 529 2004 482 86791 45.0002 531 2004 482 86791 40.5 541 2005 482 86791 41 542 2005 482 86791 41 544 2005 482 86791 41 546 2005 482 86791 45 547 2005 482 86791 44.05 548 2005 482 86791 53.9 553 2006 482 86791 34.9 559 2006 482 86791 36.9 560 2006 482 86791 38.9 561 2006 482 86791 49.5 565 2007 482 86791 37 611 2010 482 86791 38 612 2011 482 86791 47.9 613 2011 482 89132 15.05 532 2004 end format %tmMon_CCYY month
Best regards,
Fanetti
Comment