Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Alberto Zezza <azezza@hotmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Use of collapse (sum) in Multiple Imputation |
Date | Wed, 12 Oct 2011 11:15:35 +0000 |
Dear Stata Users, I am using Stata 11 for Windows (PC). I have a dataset with both individual and family level variables. Individuals are uniquely identified by a variable pid, households by a variable hhid. I have missing data for some individuals in an individual level variable x which I would like to impute, before summing it up over individuals within a household to obtain a household level variable to use in further analysis. Is there a way to do that and carry on the analysis within the mi environment in the household level file? I am currently doing the following, using an individual level data file: mi set wide mi register imputed x mi register regular y z mi impute regress x y z, add(20) mi exeq: sort hhid; collapse (sum) x _*, by (hhid) but the command stops with an error when performing the collapse for m=M (20 in mi case) saying variable _mi_id does not uniquely identify observations in the master data r(459); The variable _mi_id is not 'visible' in my list of variables so I presume this si something Stata generates in the background to manage mi data. Thanks, Alberto Zezza * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/