Dear Statalist,
I would like to produce an unbalanced region-year panel for which I drop only those region-year cells below a certain total observation threshold (50 observations).
I tried the following code:
I tried the above code but I still have some region-year cells with less than 50 observations, although I thought I dropped those region-year cells.
Please note that I do not want to drop the entire region when a region-year cell is below 50, I just want to drop that particular year for a given region.
This should generate a unbalanced panel dataset.
I would really appreciate your help.
Have a great day!
Best,
Nico
I would like to produce an unbalanced region-year panel for which I drop only those region-year cells below a certain total observation threshold (50 observations).
I tried the following code:
Code:
fillin region year bysort region year: egen freq = total(!_fillin) by region year: egen minfreq = min(freq) drop if minfreq <50 drop if _fillin
Please note that I do not want to drop the entire region when a region-year cell is below 50, I just want to drop that particular year for a given region.
This should generate a unbalanced panel dataset.
I would really appreciate your help.
Have a great day!
Best,
Nico
Comment