Hello all,
I am new to the Stata Community and working on the 2016 Canadian census of population micro dataset to create a social deprivation index using census tract level data on socio-economic characteristics of Canadians. While preparing the required variables for PCA in Stata, I found that the dataset came up with a person weight variable (COMPW2) and STATCAN has recommended using COMPW2 to represent the population in any further statistical analysis. COMPW2 weight is the same for all household members but varies across households, ranges from 1 to 17, with an average value of approximately 4. I have a focus on a particular CMA and the analysis will be done at the census tract level.
Would you please comment whether I have correct Stata commands while generating new variables using the COMPW2 weight variable.
Variable: percentage/proportions of females in each census tract
Stata Code:
*total number of females by census tract
egen nofem=total COMPW2 if sex==1, by(censustract)
alternatively, bysort censustract: egen nofem=total COMPW2 if sex==1
*total population by census tract
egen nopop=total COMPW2, by(censustract)
*proportion of females by census tract
egen propfem=nofem/nopop
Your help will be appreciated. Thanks, Liton
Related Posts with Population Census Data: Variable Preparation for PCA with sample weights
rangestat: regress by group, but not rolling window (for entire time window)Just two quick questions. 1) Is it possible to use rangestat to do regressions by group, but not fo…
How to count number of countries when you have individual-level data of many countriesHi, I need to fill in my descriptive statistic analysis sample, and thus I need to count the number…
Marginal effects command doesn't work. Don't understand error: factor variables may not contain noninteger valuesHi! I'm doing a binary logistic regression in Stata 15.0, but my supervisor told me you cannot inte…
How to count number of IDs with more than one conditionAn extract of my data is displayed below. In the data, 0=Condition is absent, and 1=Condition is pre…
Multiple imputation + ttestHi, I am struggling to find the right code that allows me to do a ttest on imputed data. mi estimate…
Subscribe to:
Post Comments (Atom)
0 Response to Population Census Data: Variable Preparation for PCA with sample weights
Post a Comment