Hello community,
I have no identifiable data or data that is confidential. I have the following code to give output for a score test using Breslow's method. The log tells me there is an issue with the 11 censored variables, maybe not reading in. I tried an ELSE statement in my code in the set statement and it doesn't fix the error with my output. This is part of a homework question. I am supposed to obtain a p-value of 0.098 for the Breslow score, but obtain a 0.9132... I don't know what I am doing wrong. I think the syntax is correct, because I have output, but I may be missing an option.
The first column of my data represents a dummy variable assignment for type of cancer tumor ( 2 kinds), time observation is the second column, and third column is if the value is censored. From proc phreg the censored value is 0.
Below is my code:
data tcancer;
input type time d;
cards;
1 1 1
1 3 1
1 3 1
1 4 1
1 10 1
1 13 1
1 13 1
1 16 1
1 16 1
1 24 1
1 26 1
1 27 1
1 28 1
1 30 1
1 30 1
1 32 1
1 41 1
1 51 1
l 65 1
1 67 1
1 70 1
1 72 1
1 73 1
1 77 1
1 91 1
1 93 1
1 96 1
1 100 1
1 104 1
1 157 1
1 167 1
1 61 0
1 74 0
1 79 0
1 80 0
1 81 0
1 87 0
1 87 0
1 88 0
1 89 0
1 93 0
1 97 0
1 101 0
1 104 0
1 108 0
1 109 0
1 120 0
1 131 0
1 150 0
1 231 0
1 240 0
l 400 0
2 l l
2 3 l
2 4 1
2 5 l
2 5 1
2 8 l
2 l2 1
2 13 l
2 l8 1
2 23 l
2 26 1
2 27 1
2 30 1
2 42 1
2 56 1
2 62 1
2 69 1
2 104 l
2 104 1
2 112 1
2 129 1
2 181 1
2 8 0
2 67 0
2 76 0
2 104 0
2 176 0
2 231 0
;
run;
data tcan1;
set tcancer;
if type = 1 then zl= 1;
ELSE zl= 0;
run;
proc phreg data=tcan1;
model time*d(0)= zl/ itprint risklimits;
run;
Also, you don't need to create an indicator variable, you should use the class statement instead.
proc phreg data=tcancer;
class type (ref='2')/param=ref;
model time*d(0)= type/ itprint risklimits;
run;
Your input data is not correct. Model is not using full number of observations.
Thank you
Thank you
Also, you don't need to create an indicator variable, you should use the class statement instead.
proc phreg data=tcancer;
class type (ref='2')/param=ref;
model time*d(0)= type/ itprint risklimits;
run;
Thank you for your help Reeza for the new insight
Reeza, I did the Ctrl+H and it did help me find the lower case l's you found, but I still get a p-valueof 0.1768 for the score test.
I also included your code to not make a new indicator variable, here is the amended code:
data tcancer;
input type time d;
cards;
1 1 1
1 3 1
1 3 1
1 4 1
1 10 1
1 13 1
1 13 1
1 16 1
1 16 1
1 24 1
1 26 1
1 27 1
1 28 1
1 30 1
1 30 1
1 32 1
1 41 1
1 51 1
1 65 1
1 67 1
1 70 1
1 72 1
1 73 1
1 77 1
1 91 1
1 93 1
1 96 1
1 100 1
1 104 1
1 157 1
1 167 1
1 61 0
1 74 0
1 79 0
1 80 0
1 81 0
1 87 0
1 87 0
1 88 0
1 89 0
1 93 0
1 97 0
1 101 0
1 104 0
1 108 0
1 109 0
1 120 0
1 131 0
1 150 0
1 231 0
1 240 0
1 400 0
2 1 1
2 3 1
2 4 1
2 5 1
2 5 1
2 8 1
2 l2 1
2 13 1
2 l8 1
2 23 1
2 26 1
2 27 1
2 30 1
2 42 1
2 56 1
2 62 1
2 69 1
2 104 1
2 104 1
2 112 1
2 129 1
2 181 1
2 8 0
2 67 0
2 76 0
2 104 0
2 176 0
2 231 0
;
run;
proc phreg data=tcancer;
class type (ref='2')/param=ref;
model time*d(0)= type/ itprint risklimits;
run;
I don't think your data is still being read in properly, does your output for number of events and censored match what I have below?
Summary of the Number of Event and Censored Values
Percent
Total Event Censored Censored
80 53 27 33.75
Here's my input data:
data tcancer;
input type time d;
cards;
1 1 1
1 3 1
1 3 1
1 4 1
1 10 1
1 13 1
1 13 1
1 16 1
1 16 1
1 24 1
1 26 1
1 27 1
1 28 1
1 30 1
1 30 1
1 32 1
1 41 1
1 51 1
1 65 1
1 67 1
1 70 1
1 72 1
1 73 1
1 77 1
1 91 1
1 93 1
1 96 1
1 100 1
1 104 1
1 157 1
1 167 1
1 61 0
1 74 0
1 79 0
1 80 0
1 81 0
1 87 0
1 87 0
1 88 0
1 89 0
1 93 0
1 97 0
1 101 0
1 104 0
1 108 0
1 109 0
1 120 0
1 131 0
1 150 0
1 231 0
1 240 0
1 400 0
2 1 1
2 3 1
2 4 1
2 5 1
2 5 1
2 8 1
2 12 1
2 13 1
2 18 1
2 23 1
2 26 1
2 27 1
2 30 1
2 42 1
2 56 1
2 62 1
2 69 1
2 104 1
2 104 1
2 112 1
2 129 1
2 181 1
2 8 0
2 67 0
2 76 0
2 104 0
2 176 0
2 231 0
;
run;
You have some "L" instead of 1 in your data, but they're lower case L's so it looks like 1's.
In your SAS code you can highlight the data, find and replace them using CTRL+H and then use the in selection only.
Then you'll get the correct p-value (0.0975)
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.