Code for survey data analysis (CHP group 2)