BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mblack-732
Fluorite | Level 6

Hi!

I'm struggling a little bit with a SAS Code... I'm trying to test for the effect of race adjusting for age, using a likelihood ratio test via the PROC PHREG method. My Code so far is as follows:

 

PROC PHREG DATA=HW9;
 CLASS age;
 MODEL time*status(0) = age;

RUN;

 

PROC PHREG DATA=HW9;
 CLASS age race;
 MODEL time*status(0) = age race;
RUN;

 

How do I get SAS to realize that I only want the difference in the model to be the race variable?

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @mblack-732,

 

Use the TYPE1 option of the MODEL statement to request that likelihood ratio test statistic and p-value:

MODEL time*status(0) = age race / type1;

This will create the additional output table "Likelihood Ratio Statistics for Type 1 Analysis" as shown below (using my random data):

           Likelihood Ratio Statistics for Type 1 Analysis

                                                      LR
Source                    -2 Log L      DF    Chi-Square    Pr > ChiSq

(Without Covariates)     1361.3610       .         .             .
age                      1350.7645       4       10.5965        0.0315
race                     1346.8845       3        3.8801        0.2747

The last row of the table contains the test results you're after.

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@mblack-732 wrote:

 

How do I get SAS to realize that I only want the difference in the model to be the race variable?


What does that mean?

--
Paige Miller
mblack-732
Fluorite | Level 6

Hi, Paige!

 

I just want SAS to compare the full model with age and race to the smaller model with just age but it doesn't seem to be doing that (I have the correct answers from R).

PaigeMiller
Diamond | Level 26

Typically, SAS doesn't compare models for you. You'd have to do the comparison using the output of each model. For ordinary regression, you can use the Extra Sum of Squares principle. I'm not sure what the equivalent is for PROC PHREG.

--
Paige Miller
FreelanceReinh
Jade | Level 19

Hi @mblack-732,

 

Use the TYPE1 option of the MODEL statement to request that likelihood ratio test statistic and p-value:

MODEL time*status(0) = age race / type1;

This will create the additional output table "Likelihood Ratio Statistics for Type 1 Analysis" as shown below (using my random data):

           Likelihood Ratio Statistics for Type 1 Analysis

                                                      LR
Source                    -2 Log L      DF    Chi-Square    Pr > ChiSq

(Without Covariates)     1361.3610       .         .             .
age                      1350.7645       4       10.5965        0.0315
race                     1346.8845       3        3.8801        0.2747

The last row of the table contains the test results you're after.

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
  • 5 replies
  • 467 views
  • 0 likes
  • 3 in conversation