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?
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.
@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?
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).
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.
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.
Thank you so much!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.