4.4 Stata preparation
In , we need to enter the following code to import the CSV file data:
import delimited [Path]/CLSARealExample.csv
To specify the sampling design, we define the stratum variables as and declare the survey design. Similar to the R program, we assume that strata with a single unit have no contribution to the variance estimation, so we put “” in “.”
generate StraVar = GEOSTRAT_TRM
svyset entity_id, strata(StraVar) weight(WGHTS_INFLATION_TRM) vce(linearized)
singleunit(certainty)
The option “” means the program will ignore the strata with single observations during variance calculation. Again, this option may not be the best one as it can underestimate the uncertainty.