/* Q: If you had to choose between these artists for the grammy, which would you pick? (0) Lady Gaga (1) Stevie Wonder Q: How old are you? _____ */ %let cut 27.2; run; proc format; value winner 1="Wonder" 0="Gaga" other = "-"; value old 0="Age < &cut" 1="Age > &cut"; title "Grammy survey"; ****************** Create Some Data *****************; data grammy; do i=1 to 30000; train = (i<2001); drop i; Age = round(40+8*normal(1827655)); age = max(age,8); p = exp(.1*(Age-30))/(1+exp(.1*(Age-30))); Y = (ranuni(123)&cut); format Y winner. old old.; proc freq data=next; tables old*Y/ nocol nopercent chisq; where train=1; title "Cut point at &cut"; output out=out1 chisq; data out1; set out1; cut=&cut; if p_pchi>0 then logworth=-1*log10(p_pchi) - log10(49); else logworth=.; *** There are 50 age groups -> 49 splits possible **; keep cut logworth _pchi_ p_pchi; proc append base=results data=out1; proc sort; by cut; proc print data=results; run; proc plot data=results; plot logworth*cut/vpos=20 hpos=40; title "Logworth for Cutoffs Thus Far"; run; /* Proc datasets; Delete results; run; */