Hello,
A very simple version of my dataset looks like this:
I have panel data (unbalanced). The variable 'firm' is a unique identifier in each year for a firm. Some firms appear in one year and then do not appear in the next. Other firms appear in one year and also appear in the next. In the example above the firm '112' appears in 2001 and also appears in the subsequent year 2002. The other two firms which appear in 2001 are '224' and '516', as you can see these firms do not appear in 2002 the subsequent year. In this quick example I made, there are two firms in 2002 ('764' and '299') which don't appear in 2001. Lets just ignore these for now.
What I want to do is for each year (I have many years not just two) to split the sample of firms into two, one group being those that appear in the subsequent year, the other group being those that don't. So ideally a variable which takes the value 1 if the firm appears in the subsequent year, and 0 if it doesn't.
Going back to the point on the two firms in 2002 '764' and '299', I also want to create another variable similar to the one just mentioned above, but this time I want to split the sample slightly differently, one group being firms which appear in the previous year and the other group being firms which don't appear in the previous year.
Any ideas on how to implement something like this?
Thanks,
Jad
A very simple version of my dataset looks like this:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(year firm) 2001 112 2001 224 2001 516 2002 112 2002 764 2002 299 end
What I want to do is for each year (I have many years not just two) to split the sample of firms into two, one group being those that appear in the subsequent year, the other group being those that don't. So ideally a variable which takes the value 1 if the firm appears in the subsequent year, and 0 if it doesn't.
Going back to the point on the two firms in 2002 '764' and '299', I also want to create another variable similar to the one just mentioned above, but this time I want to split the sample slightly differently, one group being firms which appear in the previous year and the other group being firms which don't appear in the previous year.
Any ideas on how to implement something like this?
Thanks,
Jad
Comment