#Typical call is %pstmean c1 c2-ck1 c3 c3 c10 c11 c12, where c1 contains #the stratum weights, c2-ck1 contains the stratum samples, #c10 and c11 a table of descriptive statistics, c12 the stratum sample #standard errors. The fpc is ignored in computing the standard error #of the poststratification standard error. macro pstmean subpopwt subsam.1-subsam.nl labcol descol secol mcolumn subpopwt subsam.1-subsam.nl labcol descol secol submn subsd mcolumn subsamsz mconstant nsample stratmn stsemean nl i do i=1:nl let submn(i)=mean(subsam.i) let subsd(i)=stan(subsam.i) let subsamsz(i)=count(subsam.i) enddo let nsample=sum(subsamsz) let secol=sqrt(subsd**2/subsamsz) let stratmn=sum(subpopwt*submn) let stsemean=sqrt(sum((subpopwt*subsd**2)/nsample) + sum(((1-subpopwt)*subsd**2)/nsample**2)) set labcol; format(a30). Stratified sample mean Estimated standard error end set descol stratmn stsemean end name secol 'Stratum standard errors' endmacro