I’d like to estimate the effect of different types of chemotherapies on survival of cancer patients in considering the effect of other therapies combined with chemo, such as surgery, radiation therapies controlling to cancer stage, race/eth and age. First off, I’d like to construct table shown. How to modify the code below to come up with a table shown? I tried interaction effects with no success.
Table. Multivariate analysis, chemotherapy status on survival adjusting to demographics |
||||
Variables |
Chemotherapy |
Dead (N,%) |
Alive (N,%) |
HR (95% CI) |
Surgery |
||||
Type 1 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
Type 2 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
Type 3 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
Type4 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
Radiation |
||||
Type 1 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
Type 2 |
Type1 |
N |
N |
1.00 Reference |
|
Type2 |
N |
N |
HR (LCL, UCL) |
|
Type3 |
N |
N |
HR (LCL, UCL) |
|
Type4 |
N |
N |
HR (LCL, UCL) |
|
Type5 |
N |
N |
HR (LCL, UCL) |
/*read in sample data attached*/
proc import datafile="…\have.txt"
out=have
dbms=tab replace;
getnames=yes;
guessingrows=max;
run;
proc phreg data=have;
class
raceth (ref='2')
surgery (ref='5')
chemo (ref='5')
radiation (ref='2')
stage (ref= '2');
model duration*vital_statusX(1)=chemo
surgery radiation stage
age_at_diagnosis raceth
/rl selection=stepwise slentry=0.25 slstay=0.35 details;
run;
You can’t get it by default, you can capture the ODS tables and customize the output via proc tabulate or report.
There are examples on lexjansen.com and some on my github though I think it’s not quite what you want.
Sorry, my GitHub one is PROC LIFETEST not PHREG, but it's here:
https://gist.github.com/statgeek/d3bce2a9e2ef0523db9d
The concept is similar.
1. Capture ODS tables blog post:
https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html
2. Creating Complex Reports via Cynthia Zender
https://www.lexjansen.com/pharmasug/2008/sas/SA08.pdf
3. Specific PROC PHREG example here, with code:
https://www.lexjansen.com/nesug/nesug07/po/po22.pdf
I would highly suggest reading the first two but using the code from the last paper which seems pretty close to what you're looking for. It will need modifications though, which is why you need the first two papers.
Break it into smaller steps and each one on it's own isn't too bad.
1. Capture ODS tables
2. Format using a data step
3. Proc print or report to display.
The code shown has basically generalized this so it works for any process but you don't have to do that and probably shouldn't if you've never done so. Just some examples and you can run them to see how they work and if they're close enough to what you want.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.