Hello, I have been trying to use -collapse- to calculate standard errors of the mean, binomial (seb) working with survey data. I want to produce the standard errors for three binomial variables (1/0) by region/year combination (using -bysort year reg:-). I first converted the supplied pweights to fweights to produce an integer weight using: (as -collapse- does not allow for (sem)/(seb)/(sep) with pweights):
Code:
g double w = round(_fwt*100000000)
Then I include the newly produced weight into -collapse-. The result appears to generate good values for the means (value?), but not for the standard errors (se?), they all show as missing (the set of variables nobs? - number of observations by year/region - were previously calculated so as to avoid the weights being applied to the _N by group):
Code:
collapse (mean) value1=poorfairhlth value2=asthma value3=diabetes ///
        (mean) nobs? ///
        (seb) se1=poorfairhlth se2=asthma se3=diabetes ///
        [fw=w], by(year reg)
The goal is to calculate the lower and upper limits of the confidence intervals to include in a bar graph. Thank you very much for any help.