This is the Stata&MatLab code for my WP1.