Hi,
I am trying to correct for small cell size in my data set while adding some exceptions. More specifically, I have small cells in a variable I am interested in and therefore I need to drop those cells that have less than 20 observations in them. I do this using the below code:
However, I want to keep a selection of cells that have less than 20 observations so I want to tell Stata to drop those with less than 20 observations except the ones I specify. I tried to do this using the below code but it does not do what I want as it drops everything in my dataset
Any suggestions on how I can make this work?
thanks in advance
I am trying to correct for small cell size in my data set while adding some exceptions. More specifically, I have small cells in a variable I am interested in and therefore I need to drop those cells that have less than 20 observations in them. I do this using the below code:
Code:
gen one=1 egen cellsize=count(one), by (variableofinterest) drop if cellsize<20
Code:
drop if cellsize<20 &variableofinterest!=5 |variableofinterest!=35|variableofinterest!=84
thanks in advance
Comment