/* Work problem similar to the one on p. 20 */ log using "SOCY602-GSS-Sociability-Percentile-Example.txt", replace text quietly { sum sociability if year==2006 local lb=r(mean) - invnormal(.95)*(r(sd)/(r(N)^.5)) local ub=r(mean) + invnormal(.95)*(r(sd)/(r(N)^.5)) noisily di _n _col(2) "Lower bound = " %6.2f `lb' noisily di _col(2) "mean = " %6.2f r(mean) noisily di _col(2) "Upper bound = " %6.2f `ub' } /* Solve using Stata's built-in function */ ci sociability if year==2006 log close