BookmarkSubscribeRSS Feed
JUMMY
Obsidian | Level 7

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;
11 REPLIES 11
Reeza
Super User
Use an ESTIMATE statement within the PROC GLM.
PGStats
Opal | Level 21

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;

ANCOVAPlot.png

                                 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.
PG
JUMMY
Obsidian | Level 7
@PGStats, is there anyway I can use PROC REG to do this?
PGStats
Opal | Level 21

Nothing simple. Proc reg is not meant for that.

PG
Reeza
Super User

@JUMMY wrote:
@PGStats, is there anyway I can use PROC REG to do this?

Why the fixation on PROC REG?

JUMMY
Obsidian | Level 7
@Reeza, because that is what I am comfortable with at this point.
PaigeMiller
Diamond | Level 26

@JUMMY 

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.

--
Paige Miller
JUMMY
Obsidian | Level 7
@PGStats, based on the output above, how do we draw conclusions? I am not sure how PROC GLM works?
PGStats
Opal | Level 21

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.

PG
JUMMY
Obsidian | Level 7
@PGStats,and what would be the hypothesis test statement. That is, null and alternative statement?
PGStats
Opal | Level 21

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"

PG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 1301 views
  • 3 likes
  • 4 in conversation