#Typical call is %stmean2 c2-ck c1 c3 c10 c11 c12 c13, where c2-ck contains #the stratum samples, c2 contains the stratum sizes #c10 and c11 a table of descriptive statistics, c12 the individual #stratum means and c13 the individual stratum standard errors macro stmean2 stsam.1-stsam.nlevel subpopsz labcol descol mcol secol mcolumn stsam.1-stsam.nlevel samsiz labcol descol mcol secol subpopsz mconstant npop nlevel stratmn stsemean i mmatrix matsam do i=1:nlevel let samsiz(i)=count(stsam.i) let mcol(i)=mean(stsam.i) let secol(i)=stan(stsam.i)*sqrt((subpopsz(i)-samsiz(i))/(subpopsz(i)*samsiz(i))) enddo let npop=sum(subpopsz) let stratmn=sum(subpopsz*mcol/npop) let stsemean=sqrt(sum((subpopsz*secol/npop)**2)) set labcol; format(a30). Stratified sample mean Estimated standard error end set descol stratmn stsemean end name mcol 'Stratum means' name secol 'Stratum standard errors' endmacro