Dear Statalist Community,
I'm working on an unbalanced panel dataset, a toy example is presented below
My task is to identify those suppliers who have been with the firm for atlas 3 "consecutive" years and categorize them as belonging to a particular class. Specifically, my ideal output table would be as follows
Any help in solving this is much appreciated.
Many thanks!
I'm working on an unbalanced panel dataset, a toy example is presented below
Input Data | |||
Year | Firm | Supplier | |
2010 | A | XX | |
2010 | A | XY | |
2010 | A | XZ | |
2010 | B | ZZ | |
2010 | B | XX | |
2011 | A | XX | |
2011 | A | XY | |
2011 | B | XY | |
2011 | B | ZZ | |
2012 | A | XX | |
2012 | A | XY | |
2012 | A | ZZ | |
2012 | A | XZ | |
2012 | B | ZZ | |
Output Status | |||
Year | Firm | Supplier | Category |
2012 | A | XX | 1 |
2012 | A | XY | 1 |
2012 | A | ZZ | 0 |
2012 | A | XZ | 0 |
2012 | B | ZZ | 1 |
Many thanks!
Comment