Many thanks for the help. Could any one point to me what the problem is in the following for loop, please? forvalues i=1(1)6{ forvalues j= `i'+1 /7{ prtest FLAG_ChoseBestHosp1 if ( BG_Condition_recode==`i'| BG_Condition_recode==`j'), by( BG_Condition_recode) } } Best wishes, Helen On 19 October 2010 23:08, helen bian <[log in to unmask]> wrote: > Dear all, > > Has anyone written a program that does a pairwise test of proportions > and contains the p-values in its output? > > Many thanks in advance. > Best wishes, > Helen > You may leave the list at any time by sending the command SIGNOFF allstat to [log in to unmask], leaving the subject line blank.