I have some difficulties dropping observations.
If the ID did not receive subsidy in all the months (2015m9 (668) up to 2016m8 (678)), I would like to drop them and if the ID received subsidy in ANY of the 12 months, I would like to keep all the observations for that ID.
so in the example below, I want to drop ID 1 but keep all the observations for ID 2.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(ID month subsidy) 1 668 0 1 669 0 1 670 0 1 671 0 1 672 0 1 673 0 1 674 0 1 675 0 1 676 0 1 677 0 1 678 0 1 679 0 2 668 1 2 669 1 2 670 0 2 671 0 2 672 0 2 673 0 2 674 0 2 674 1 2 675 1 2 676 1 2 676 1 2 678 0 end format %tm month
Thank you!
0 Response to drop in all range
Post a Comment