4.4 Stata preparation

In \(\texttt{Stata}\), 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 \(\texttt{WGHTS_GEOSTRAT_TRM}\) 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 “\(\texttt{certainty}\)” in “\(\texttt{singleunit()}\).”

generate StraVar = GEOSTRAT_TRM 
svyset entity_id, strata(StraVar) weight(WGHTS_INFLATION_TRM) vce(linearized) 
                  singleunit(certainty)  

The option “\(\texttt{singleunit(certainty)}\)” 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.