Hello SAS communities!
I am currently working on a project and encountered some issues so I am posting these questions!
1. Suppose, we are submitting following codes in PROC PHREG: time*event(0)=main_effect sex, where sex is a binary variable. We are trying to output hazard ratio of the main effect by each level of the categorical variable. When I include HAZARDRATIO option within PROC PHREG procedure, it returns the hazard ratio that shows how different male is from female. Instead, I subset the data set by sex. One data set with only male and another data set with only female. And run PROC PHREG each of the data sets and output hazard ratio of the main effect; we will have one hazard ratio of the male population and another hazards ratio of the female population. Is this a valid approach?
2. Is there any option within PROC PHREG procedure will output the hazard ratios I need from above question? For example, LSMEANS does the job in PROC MIXED, LOGISTICS, and other procedures.
Thanks in advance and let me know if anything is unclear!
Essentially, you are asking about the difference between BY-group processing to analyze separate groups of data versus using the CLASS statement (and including the CLASS variable in the model) to compare across groups. I have an extensive discussion with examples in the article "The difference between CLASS statements and BY statements in SAS."
If your intention is to compare survival between sexes, you should include SEX in the model.
To address your questions:
1. When you include SEX in the model, you can compare the survival between males/females. If you use BY SEX, then the predicted values for the regression should be the same, but you have no way to compare the relative risks, odds ratios, etc.
2. I'm not sure what you are asking here. The PHREG procedure supports the ESTIMATE and CONTRAST statements.
Essentially, you are asking about the difference between BY-group processing to analyze separate groups of data versus using the CLASS statement (and including the CLASS variable in the model) to compare across groups. I have an extensive discussion with examples in the article "The difference between CLASS statements and BY statements in SAS."
If your intention is to compare survival between sexes, you should include SEX in the model.
To address your questions:
1. When you include SEX in the model, you can compare the survival between males/females. If you use BY SEX, then the predicted values for the regression should be the same, but you have no way to compare the relative risks, odds ratios, etc.
2. I'm not sure what you are asking here. The PHREG procedure supports the ESTIMATE and CONTRAST statements.
Thank you very much for your answer!
What I was asking was stratified analysis (I was not clear!).
This can be achieved by using WHERE statement in PROC SURVEYREG.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.