I am attempting to calculate several standardized variables in Stata using data from the Education Longitudinal Study (ELS:2002). ELS has a complex survey design including weights since certain sub-populations were oversampled. In the ELS codebook, the US National Center for Education Statistics provides the SAS code they used to calculate socioeconomic status (variable F1SES2), which I am using as an example of standardizing a variable using this data. I would like to create several other standardized variables in Stata, but the 'egen std()' command does not support weights for either the calculation of the mean or the variance used in the standardization process.
Here is the type of SAS command I am having trouble replicating in Stata (copied from a portion of the NCES ELS codebook entry explaining variable F1SES2):
/* SAS procedure PROC STANDARD is used for creating standardized
'Z-scores'. It reads in edc_M, edc_F, occ_M, occ_F, BYINCOME, or
Items and created said scores. Values for each variable will have a
mean of zero and standard deviation of 1. Calculations are weighted
using F1QWT.
Proc Standard data=F1SES2 out=F1SES2OUT M=0 STD=1 VARDEF=weight
Var edc_M edc_F occ_M occ_F Cdataincome Items
Weight F1QWT
run
Specifically, there does not appear to be an equivalent to either "VARDEF=weight" (to specify the divisor to use for calculating the variance) or "Weight F1QWT" in Stata. Is anyone aware of a relevant technique or a user written Stata command I've missed that would help calculate standardized variables using weighted data? Thanks for any suggestions about how to approach this.
Catherine Manly
Doctoral student, higher education
Education Policy, Research and Administration
University of Massachusetts, Amherst
[email protected]
Here is the type of SAS command I am having trouble replicating in Stata (copied from a portion of the NCES ELS codebook entry explaining variable F1SES2):
/* SAS procedure PROC STANDARD is used for creating standardized
'Z-scores'. It reads in edc_M, edc_F, occ_M, occ_F, BYINCOME, or
Items and created said scores. Values for each variable will have a
mean of zero and standard deviation of 1. Calculations are weighted
using F1QWT.
Proc Standard data=F1SES2 out=F1SES2OUT M=0 STD=1 VARDEF=weight
Var edc_M edc_F occ_M occ_F Cdataincome Items
Weight F1QWT
run
Specifically, there does not appear to be an equivalent to either "VARDEF=weight" (to specify the divisor to use for calculating the variance) or "Weight F1QWT" in Stata. Is anyone aware of a relevant technique or a user written Stata command I've missed that would help calculate standardized variables using weighted data? Thanks for any suggestions about how to approach this.
Catherine Manly
Doctoral student, higher education
Education Policy, Research and Administration
University of Massachusetts, Amherst
[email protected]
Comment