BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
nsns
Quartz | Level 8

Hi .

What is the correct code using Proc GLM to test a 2-groups one-sided hypothesis where the hypothesis is H0:  Difference between groups <= 4, H1: Difference between groups > 4?  The model will include baseline and site as covariates.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

See this note on one-sided testing and using a non-zero null value. For example, you can PROC ORTHOREG which is the modern regression procedure that has the most up-to-date capabilities available, including the LSMESTIMATE statement that allows you to estimate and compare means and to specify a null value other than zero (TESTVALUE=) and one-sided tests (UPPER and LOWER). See the ORTHOREG documentation for details. For example, the following tests whether the difference between the F and A drugs exceeds 4.

data DrugTest;
   input Drug $ PreTreatment PostTreatment @@;
   datalines;
A 11  6   A  8  0   A  5  2   A 14  8   A 19 11
A  6  4   A 10 13   A  6  1   A 11  8   A  3  0
D  6  0   D  6  2   D  7  3   D  8  1   D 18 18
D  8  4   D 19 14   D  8  9   D  5  1   D 15  9
F 16 13   F 13 10   F 11 18   F  9  5   F 21 23
F 16 12   F 12  5   F 12 16   F  7  1   F 12 20
;
proc orthoreg data=DrugTest;
   class Drug;
   model PostTreatment = Drug PreTreatment;
   lsmestimate Drug 'F-A>4' -1 0 1 / testvalue=1 upper;
run;

View solution in original post

4 REPLIES 4
StatDave
SAS Super FREQ

See this note on one-sided testing and using a non-zero null value. For example, you can PROC ORTHOREG which is the modern regression procedure that has the most up-to-date capabilities available, including the LSMESTIMATE statement that allows you to estimate and compare means and to specify a null value other than zero (TESTVALUE=) and one-sided tests (UPPER and LOWER). See the ORTHOREG documentation for details. For example, the following tests whether the difference between the F and A drugs exceeds 4.

data DrugTest;
   input Drug $ PreTreatment PostTreatment @@;
   datalines;
A 11  6   A  8  0   A  5  2   A 14  8   A 19 11
A  6  4   A 10 13   A  6  1   A 11  8   A  3  0
D  6  0   D  6  2   D  7  3   D  8  1   D 18 18
D  8  4   D 19 14   D  8  9   D  5  1   D 15  9
F 16 13   F 13 10   F 11 18   F  9  5   F 21 23
F 16 12   F 12  5   F 12 16   F  7  1   F 12 20
;
proc orthoreg data=DrugTest;
   class Drug;
   model PostTreatment = Drug PreTreatment;
   lsmestimate Drug 'F-A>4' -1 0 1 / testvalue=1 upper;
run;
nsns
Quartz | Level 8

Thank you. 

This looks great - thank you.

I compared the estimates to the estimates of the Proc GLM and they were the same.

(In the code below, Should the testvalue=4 in the lsmestimate line?)

 

 

StatDave
SAS Super FREQ
Yes, sorry, I had just been using 1 initially.
nsns
Quartz | Level 8

All good.  Thank you so much for your help.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 838 views
  • 5 likes
  • 2 in conversation