*********************************************************************** * This is a program that illustrates the use of PROC FREQ and PROC * * GLM in SAS for performing trend tests. * ***********************************************************************; proc format; value groupfmt 0='Placebo' 1='20 mg' 2='60 mg' 3='180 mg'; value reactfmt 0='F' 1='S'; run; data contin; input group subject response; cards; 0 01 27 0 02 28 0 03 27 0 04 31 0 05 34 0 06 32 1 01 31 1 02 35 1 03 34 1 04 32 1 05 31 1 06 33 2 01 32 2 02 33 2 03 30 2 04 34 2 05 37 2 06 36 3 01 40 3 02 39 3 03 41 3 04 38 3 05 42 3 06 43 ; run; proc glm data=contin; class group; model response=group; contrast 'Trend Test' group -1.5 -0.5 0.5 1.5; title "Parametric Trend Test for Continuous Data"; run; proc freq data=contin; tables group*response/jt; title "Jonckheere-Terpstra Trend Test for Continuous Data"; run; data binary; set contin; if group=0 then dose=0; if group=1 then dose=20; if group=2 then dose=60; if group=3 then dose=180; if response<32 then react=0; if response>=32 then react=1; format react reactfmt.; run; proc freq data=binary; tables react*group/jt trend; exact jt trend; title "Jonckheere-Terpstra and Cochran-Armitage Trend Tests for Binary Data"; title2 "Ordinal Scores"; run; proc freq data=binary; tables react*dose/jt trend; exact jt trend; title "Jonckheere-Terpstra and Cochran-Armitage Trend Tests for Binary Data"; title2 "Dose Scores"; run;