Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Stas Kolenikov <skolenik@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Non integer weights - problem |
Date | Sun, 5 Feb 2012 22:50:16 -0500 |
I second Nick -- there are few, if any, problems that would require you to collapse your data with weights. What is the analytic task that you are performing that requires this transformation? If you need to compute some sort of totals, then you might be better off with total whatever [pw=weights], over( grouping variables ) or better yet svy : total whatever , over( grouping variables ) provided your data are -svyset- properly. On Sun, Feb 5, 2012 at 5:12 PM, Raquel Guimaraes <raquelrguimadem@gmail.com> wrote: > Dear all, > > I had a problem using collapse and expanding my sample using frequency > weights: > > . collapse (count) id [fw=wtper], by (granosest sex) > may not use noninteger frequency weights > > However, I summarized the weight variable and they seem to be fine: > > . sum wtper > > Variable | Obs Mean Std. Dev. Min Max > -------------+-------------------------------------------------------- > wtper | 3971891 17.56003 8.800185 2 167.13 > > In order to solve this, I tried to create new rounded values, but none was > created: > > . replace wtper_rounded=0 if wtper<0 > (0 real changes made) > > Also, I tried to recast, but the error persists. > > . recast int wtper > wtper: 3932021 values would be changed; not changed > > . collapse (count) id [fw=wtper], by (granosest sex) > may not use noninteger frequency weights -- Stas Kolenikov, also found at http://stas.kolenikov.name Small print: I use this email account for mailing lists only. * * 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/