BookmarkSubscribeRSS Feed
Ri0
Calcite | Level 5 Ri0
Calcite | Level 5

Recently, I have been using SAS to conduct a COX regression analysis on the complex sample survey design of the NHANES. However, I have found that SAS does not report the results of the joint test when using SURVEYPHREG procedure.

The first 6 rows of the data are shown below: 

 

  weight SDMVPSU SDMVSTRA demo_sex demo_age homa_ir mor_mortstat mor_peryear overall_selected
1  6615.       3        1 male     >=60     -0.0888            1        14.8                0
2 10487.       2        7 female   18-60     0                 9        99                  0
3 19694.       2        8 male     18-60     1.75              0        20.3                0
4  6587.       2        4 female   18-60     1.04              0        19.8                0
5  7203.       1        6 male     18-60     0.666             9        99                  0
6  1504.       2        9 female   18-60     0                 9        99                  0

 

 

The code used in the analysis is shown below:

proc surveyphreg data = work.nhanes_data varmethod = taylor nomcar;
weight weight; 
strata sdmvstra;
cluster sdmvpsu;
class demo_sex demo_age;
model mor_peryear*mor_mortstat(0) = homa_ir demo_age demo_sex homa_ir*demo_sex;
domain overall_selected;
run;

 

After using the above code without obtaining the results of the joint test, I tried using the surveylogistic procedure and the phreg procedure for analysis, and obtained the results of the joint test using the similar code. The relevant code is shown below.

proc surveylogistic data = work.nhanes_data varmethod = taylor nomcar;
weight WEIGHT;
strata SDMVSTRA;
cluster SDMVPSU;
class demo_sex demo_age;
model mor_mortstat(desc) = homa_ir demo_age demo_sex homa_ir*demo_sex;
domain overall_selected;
run;

proc phreg data = work.nhanes_data;
class demo_sex demo_age;
model mor_peryear*mor_mortstat(0) = homa_ir demo_age demo_sex homa_ir*demo_sex;
run;

Finally, I searched the official SAS procedure documentation provided. However, as a new user, I did not find the precise solution in the SAS Help Center documentation (https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_surveyphreg_overview.htm).

 

I even tried to use ChatGPT to find working code, but the code or suggestions it provided did not work.

Therefore, I hope that the experts in the community can provide relevant guidance on how to conduct a joint test using the surveyphreg procedure. Thanks a million(☆▽☆)

 
 
 
 
 
3 REPLIES 3
Zard
SAS Employee

Joint F tests in SURVEYPHREG are done with the JOINT option in the ESTIMATE statement. Here is an example, written by a colleague:

 

The example below constructs a joint F test for A and B. The E option in the ESTIMATE statement prints the L matrix.

 

proc surveyphreg data = dset;

   weight wt;

   strata str;

   cluster id;

   model time*status(0) = a b;

   estimate a 1, b 1 / joint e;

run;

 

If a and b are the only two covariates in the model, then you can use the test from the “Testing Global Null Hypothesis” table. Test for the global null is computed by default. In addition, PROC SURVEYPHREG supports a few degrees of freedom adjustment methods for testing the global null.

Ri0
Calcite | Level 5 Ri0
Calcite | Level 5

Oh my friend, I finally got the output results without error by using your code. However, I have three questions about the existing code.

 

Firstly, although the code can run properly, I am not quite sure what does the number 1 after the variable name indicate in the estimate statement, and how does the content after the estimate statement inform SAS to perform a joint test?

 

Secondly, where should the p-value indicating the significance of joint test be located in the results of SAS output? I originally guessed that it should be in the F test at the end of the estimation section. However, in that section, the numerator degrees of freedom is 1 and other parts including p-values are blank (as shown in the figure below)."

 

Ri0_0-1682424220268.png

 

 

Thirdly, should the interaction term be included as a covariate in the model statement? The reason why I have this doubt is that I found that the interaction effects obtained by the following two code sections are exactly the same.

proc surveyphreg data = work.nhanes_data varmethod = taylor nomcar;
weight WEIGHT;
strata SDMVSTRA;
cluster SDMVPSU;
class demo_age demo_sex;
model mor_peryear*mor_mortstat(0) = homa_ir demo_age demo_sex;
estimate homa_ir 1, demo_age 1 /joint e;
domain overall_selected;
run;
proc surveyphreg data = work.nhanes_data varmethod = taylor nomcar;
weight WEIGHT;
strata SDMVSTRA;
cluster SDMVPSU;
class demo_age demo_sex;
model mor_peryear*mor_mortstat(0) = homa_ir demo_age demo_sex;
estimate homa_ir 1, demo_sex 1 /joint e;
domain overall_selected;
run;

The only difference between the above two code sections is the variables specified in the estimate statement. So I guess the interaction term may also should be in the model statement as a covariate.

 

Thank you very much for taking the time to answer my questions despite your busy schedule. Thank you so much!

Zard
SAS Employee

The E option in the ESTIMATE statement prints the L matrix, so that you can confirm your specification is estimating what you want it to. The JOINT option is what actually performs the joint test. The 1’s are the coefficients for the estimate you want. If you are unfamiliar with the concepts and syntax for writing contrasts and estimates, you will need to do a bit of homework. There is good SAS Note and many posts here in the Communities.

 

Yes, the joint test result is the F test at the end. It’s easier to navigate the output if you add labels in your ESTIMATE statements. Such as:

 

   estimate “Joint test of A and B” a 1, b 1 / joint e;

 

You don’t have an interaction effect in your model, so the model results are the same. They are not affected by ESTIMATE statements. Your estimate is non-estimable, though. Since you have a 2-level class var, I believe this is what you want, but I have not confirmed it:

estimate homa_ir 1, demo_age 1 -1 /joint e;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 823 views
  • 1 like
  • 2 in conversation