#Typical call is %stallocm c1 c2 c3 k1 c11 c12 c13 c14, where c1 contains #stratum costs, c2 contains the stratum sizes, c3 contains the #stratum standard deviations, k1 the desired value of D (D=B*B/4), #c11 and c12 a table of descriptive statistics, c12 the stratum weights #and c13 the sample sizes. macro stallocm costcol sizecol sdcol d labcol descol wtcol samszcol mcolumn costcol wtcol sizecol sdcol labcol descol samszcol dencol & numcol1 numcol2 mconstant d nstrat popsize samtot let nstrat=count(costcol) let popsize=sum(sizecol) let numcol1=sizecol*sdcol/sqrt(costcol) let numcol2=sizecol*sdcol*sqrt(costcol) let dencol=sizecol*sdcol**2 let samtot=sum(numcol1)*sum(numcol2)/(popsize**2*d+sum(dencol)) let wtcol=numcol1/sum(numcol1) let samszcol=samtot*wtcol let samtot=round(samtot) let samszcol=round(samszcol) set labcol; format(a30). Total sample size end set descol samtot end name wtcol 'Stratum Weights' name samszcol 'Stratum Sample Sizes' endmacro