Identifying Unique Observations
Context: multi-level data. For example, you have a patient-level dataset but want to know how many hospitals performed a certain kind of operation by volume quintile.
The easier method is to:
ssc inst unique /* downloads unique command */ cap drop temp_hospvols /* drop this variable prior to generation */ unique hospid4merge, by(op_1 cat5hospvol) gen(temp_hospvol) drop temp_hospvols
Alternatives include running codebook with different levels of restrictions in a loop.
forval op = 500(100)(700){ forval vq = 1/5{ codebook hospid4merge if op_1 == `op' & cat5hospvol == `vq' } // closes volume quintile loop } // closes operative code loop
For more information see also http://bit.ly/1fl6MJs













