Hello,
I wanted to make a table using my data, which is comprised of 5 different cohorts, each with their own sampling weights. I can use the below code to create an excellent table:
However, I need to apply sampling weights to this regression. Each of the 5 cohorts have their own sampling weights (in other words I have variables samplingweight_1992 samplingweight_1998 samplingweight_2004 samplingweight_2010 and samplingweight_2016). I understand that I were not using the Collect system, I can just use the below code to run the regression using survey weights:
However, I am unable to find a way to collect values from the svy/svyset commands with the Collect system. Is there an approach of collecting the _r_b and _r_ci from a "svy: logistic" regression, and make a Collect system table with them as shown above?
Thank you so much in advance, and also my apologies for not providing a sample data_set and sample output. If you can recommend me a web dataset that has multiple cohort sampling weights (I am not sure which one is appropriate), I would be very happy to reword the question using that specific dataset!
I wanted to make a table using my data, which is comprised of 5 different cohorts, each with their own sampling weights. I can use the below code to create an excellent table:
Code:
foreach cohortyear in 1992 1998 2004 2010 2016 { collect _r_b _r_ci, tag(model[`cohortyear']): logistic outcome_variable exposure_variable covriate_1 covariate_2 if cohort_year == `cohortyear' } collect layout /// (colname[_cons 0.exposure_variable 1.exposure_variable 0.covriate_1 1.covriate_1 0.covariate_2 1.covariate_2]#result) /// (model)
However, I need to apply sampling weights to this regression. Each of the 5 cohorts have their own sampling weights (in other words I have variables samplingweight_1992 samplingweight_1998 samplingweight_2004 samplingweight_2010 and samplingweight_2016). I understand that I were not using the Collect system, I can just use the below code to run the regression using survey weights:
Code:
foreach cohortyear in 1992 1998 2004 2010 2016 { svyset secu [pweight=samplingweight_`cohortyear'], singleunit(certainty) strata(stratum) vce(linearized) svy: logistic outcome_variable exposure_variable covriate_1 covariate_2 if cohort_year == `cohortyear' }
However, I am unable to find a way to collect values from the svy/svyset commands with the Collect system. Is there an approach of collecting the _r_b and _r_ci from a "svy: logistic" regression, and make a Collect system table with them as shown above?
Thank you so much in advance, and also my apologies for not providing a sample data_set and sample output. If you can recommend me a web dataset that has multiple cohort sampling weights (I am not sure which one is appropriate), I would be very happy to reword the question using that specific dataset!
Comment