data autism; input vaccn8ed yr_born age_mid ch_yrs n_cases; ln_cy = log(ch_yrs); LINES; 1 91 1.5 31027 4 0 91 1.5 35973 4 1 91 2.5 61809 9 0 91 2.5 5191 0 1 91 3.5 61975 8 0 91 3.5 5025 2 1 91 4.5 61975 12 0 91 4.5 5025 2 1 91 5.5 61975 17 0 91 5.5 5025 0 1 91 6.5 61975 7 0 91 6.5 5025 1 1 91 7.5 61975 7 0 91 7.5 5025 1 1 91 8.25 30987 2 0 91 8.25 2512 0 1 92 1.5 30565 0 0 92 1.5 36435 0 1 92 2.5 60889 7 0 92 2.5 6111 1 1 92 3.5 61052 18 0 92 3.5 5948 0 1 92 4.5 61052 16 0 92 4.5 5948 1 1 92 5.5 61052 12 0 92 5.5 5948 1 1 92 6.5 61052 7 0 92 6.5 5948 0 1 92 7.25 30526 1 0 92 7.25 2974 0 1 93 1.5 30110 4 0 93 1.5 36890 0 1 93 2.5 59983 13 0 93 2.5 7017 0 1 93 3.5 60143 15 0 93 3.5 6857 2 1 93 4.5 60143 15 0 93 4.5 6857 3 1 93 5.5 60143 11 0 93 5.5 6857 4 1 93 6.25 30072 5 0 93 6.25 3428 0 1 94 1.5 29662 4 0 94 1.5 37338 5 1 94 2.5 59090 3 0 94 2.5 7910 1 1 94 3.5 59248 10 0 94 3.5 7752 1 1 94 4.5 59248 10 0 94 4.5 7752 3 1 94 5.25 29624 6 0 94 5.25 3876 0 1 95 1.5 29220 0 0 95 1.5 37780 3 1 95 2.5 58210 8 0 95 2.5 8790 2 1 95 3.5 58366 10 0 95 3.5 8634 2 1 95 4.25 29183 11 0 95 4.25 4317 0 1 96 1.5 28785 1 0 96 1.5 38215 1 1 96 2.5 57343 3 0 96 2.5 9657 0 1 96 3.25 28748 3 0 96 3.25 4752 1 1 97 1.5 28357 4 0 97 1.5 38643 4 1 97 2.25 28174 2 0 97 2.25 5326 1 1 98 1.25 3320 1 0 98 1.25 30180 3 ; title 'overall... '; proc means sum; class vaccn8ed ; var ch_yrs n_cases ; run; title 'analysis 0 ... '; proc genmod data=autism; model n_cases = / link=log error = poisson offset=ln_cy; run; options ls=75 ps=55; title 'set up for mantel-haenszel ' ; data for_mh; keep age_mid vaccn8ed outcome number; set autism; outcome = 1; number = n_cases; output; outcome = 0; number = ch_yrs ; output; ******** For mantel-haenszel summary statistics, PROC FREQ always contrasts row 1 (index category) with row 2 (reference). If we used 0 for unexposed and 1 for exposed, row 1 would be the UNexposed. SO... use proc format to give 0 a formatted value that is AFTER 1 -- alphabetically . Then use the format statement in proc freq along with the order = formatted option, to force it to use the formatted value rather than the original numerical value... and make sure you put a period at the end of the alias you use to stand for the formatted values the reason for the period.. sas needs some way to distinguish the name of the alias from the name(s) of (legitimate) variable(s). **********; proc format; value verso 1 = 'a-vaccinated' 0 = 'z-unvaccinated' ; run; title 'm-h analysis ... '; proc freq data=for_mh order = formatted; tables age_mid * vaccn8ed * outcome / cmh ; weight number; format vaccn8ed verso. ; run; title 'test with 1 stratum .. ' ; proc freq data=for_mh order = formatted; tables age_mid * vaccn8ed * outcome / cmh ; weight number; format vaccn8ed verso. ; where (age_mid = 1.5 ); run; title 'analysis 1 ... '; proc genmod data=autism; model n_cases = vaccn8ed / link=log error = poisson offset=ln_cy; run; title 'analysis 2 ... '; proc genmod data=autism; model n_cases = age_mid vaccn8ed / link=log error = poisson offset=ln_cy; run; title 'analysis 3 ... '; proc genmod data=autism; class age_mid; model n_cases = age_mid vaccn8ed / link=log error = poisson offset=ln_cy; run; run; title 'analysis 4 ... '; proc genmod data=autism; class age_mid; model n_cases = age_mid yr_born vaccn8ed / link=log error = poisson offset=ln_cy; run; title 'set up data for breslow (conditional) analysis ... '; proc sort data=autism; by age_mid vaccn8ed ; proc means data=autism sum; by age_mid vaccn8ed ; var ch_yrs n_cases ; output out = age_x_v sum = ch_yrs n_cases ; run; proc sort data = age_x_v ; by age_mid ; run; data breslow; keep age_mid t_cases v_cases u_cases cy_v cy_u cy_tot ratio ln_ratio ; retain v_cases u_cases cy_v cy_u cy_tot; set age_x_v; by age_mid; if vaccn8ed=1 then do; v_cases = n_cases ; cy_v = ch_yrs ; end; if vaccn8ed=0 then do; u_cases = n_cases ; cy_u = ch_yrs ; end; if last.age_mid then do; t_cases = v_cases + u_cases; cy_tot = cy_v + cy_u ; ratio = cy_v/cy_u; ln_ratio = log(ratio); output; end; proc print data=breslow; run; title 'analysis 5 ... '; proc genmod data=breslow; model v_cases/t_cases = / link=logit error = binomial offset=ln_ratio; run; run;