How do I test that xx scores are the same for the UGA and USC students with a xxx of 3.00 given the data below?
data have;
input university $ xxx xx@@;
datalines;
UGA 2.1 440 UGA 2.2 330 UGA 2.2 460 UGA 2.3 460 UGA 2.4 480
UGA 2.6 510 UGA 3.3 560 UGA 3.4 670 UGA 3.5 630 UGA 3.6 680
UNC 2.4 470 UNC 2.7 650 UNC 2.8 550 UNC 2.9 600 UNC 3.1 660
UNC 3.2 670 UNC 3.4 690 UNC 3.5 690 UNC 3.5 730 UNC 3.5 760
USC 2.2 430 USC 2.3 440 USC 2.4 480 USC 2.5 480 USC 2.9 570
USC 3.0 510 USC 3.2 580 USC 3.5 630 USC 3.6 770 USC 3.9 760
;
proc print;
run;
Use the AT option in the LSMEANS statement (available in many procs):
proc glm data=have;
class university;
model xx = xxx | university;
lsmeans university / at xxx=3 pdiff;
run;
The GLM Procedure Least Squares Means at xxx=3 LSMEAN university xx LSMEAN Number UGA 562.411348 1 UNC 627.000000 2 USC 574.772370 3 Least Squares Means for effect university Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: xx i/j 1 2 3 1 0.0040 0.5421 2 0.0040 0.0133 3 0.5421 0.0133 NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used.
Nothing simple. Proc reg is not meant for that.
If you are going to do modeling in SAS, and you have categorical variables, then PROC GLM is a fundamental tool that you need to learn. It will make your life easier, and enable you to fit a very wide selection of models. And in this case @PGStats has provided the solution.
As you can see, no one wants you to create dummy variables for PROC REG.
The model fitted in the above analysis is an ANCOVA (analysis of covariance). It is covered in every textbook about analysis of variance. The analysis tests for a difference between groups (universities) after correction for a covariate (xxx). The results displayed in the lsmeans table indicate that there is no significant difference between UGA and USC xx scores when xxx=3. This is also evident on the graph.
Quoting you @JUMMY , the null hypothesis would be:
"xx scores are the same for the UGA and USC students with a xxx of 3.00"
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.