*-- Demonstration of CATPLOT macro; *include macros(catplot); goptions vsize=7 in hsize=6.7 in htext=1.5; title 'Berkeley Admissions Data'; proc format; value dept 1="A" 2="B" 3="C" 4="D" 5="E" 6="F"; data berkeley; do dept = 'A','B','C','D','E','F'; do gender = 'Male ', 'Female'; do admit = 'Admit', 'Reject'; input freq @@; output; end; end; end; /* Admit Not */ cards; 512 313 89 19 353 207 17 8 120 205 202 391 138 279 131 244 53 138 94 299 22 351 24 317 ; proc catmod order=data data=berkeley; weight freq; response / out=predict; model admit = dept gender / ml noiter noprofile ; run; axis1 order=(-3 to 2) offset=(4) label=(a=90 'Log Odds (Admitted)'); axis2 label=('Department') offset=(4); *-- Use axis on right for probability scale. To make this read in the same direction as the left axis, use r=180 and reverse the character string; title h=1.9 'Berkeley Admissions Data' h=1.5 a=-90 r=180 ')dettimdA( ytilibaborP' h=3.0 a=-90 ' '; title2 h=1.6 'Observed and Fitted Logits (95% CI)'; title3 h=1.6 'Model: logit(Admit) = Dept Gender'; legend1 position=(bottom inside left) offset=(4,3) mode=share cborder=blue across=1 shape=symbol(6,1.5) label=('Gender') value=(c=black 'Female' c=red 'Male'); data pscale; xsys = '1'; * percent values for x; ysys = '2'; * data values for y; length text $4; style='DUPLEX'; size=1.4; do prob = .05,.1,.25,.5,.75,.9; logit = log( prob / (1-prob) ); * convert to logit; y = logit; x = 98.7; function='MOVE '; output; * tick marks; x = 100; function='DRAW '; output; text = put(prob,3.2); position='6'; * values; function='LABEL '; output; end; %catplot(data=predict, class=gender, xc=dept, z=1.96, anno=pscale, legend=legend1);