Hi there,
I am wanting to generate a stata dataset that consists of weighted counts, including the standard error of the weighted counts.
I am using NIS (national inpatient sample) data to estimate national hospitalization rates.
To me, the most efficient way to obtain the weighted counts of 'hospitalisations' (by age group and sex) is to use the collapse command as follows:
collapse (sum) hospital_visit [pweight=finalwt], by(age_4 sex)
But this command does not allow me to retain the SE of the weighted counts.
The following command, however, allows me to estimate counts and SE, but I do not know how to export this information into a stata dataset that has weighted counts and SE of weighted counts, by age and sex
svyset [pweight=finalwt], psu(hospid) strata(nis_stratum) vce(linearized) singleunit(certainty)
svy, subpop(if sex==1): total hospital_visit, over(age_4)
I have several files I want to merge, and so am looking for an efficient way to keep them all in stata datasets, rather than exporting to excel, for example, and then converting back to stata.
Any help would be appreciated.
Jess
I am wanting to generate a stata dataset that consists of weighted counts, including the standard error of the weighted counts.
I am using NIS (national inpatient sample) data to estimate national hospitalization rates.
To me, the most efficient way to obtain the weighted counts of 'hospitalisations' (by age group and sex) is to use the collapse command as follows:
collapse (sum) hospital_visit [pweight=finalwt], by(age_4 sex)
But this command does not allow me to retain the SE of the weighted counts.
The following command, however, allows me to estimate counts and SE, but I do not know how to export this information into a stata dataset that has weighted counts and SE of weighted counts, by age and sex
svyset [pweight=finalwt], psu(hospid) strata(nis_stratum) vce(linearized) singleunit(certainty)
svy, subpop(if sex==1): total hospital_visit, over(age_4)
I have several files I want to merge, and so am looking for an efficient way to keep them all in stata datasets, rather than exporting to excel, for example, and then converting back to stata.
Any help would be appreciated.
Jess
Comment