t*******0 发帖数: 64 | 1 对age>20的病人,用Cox model, predictor包括age, RACE="B"(character variable:
e.g. A, B, C, O), medhistory(0,1 variable)。 要找出每个predictor的HR 及
Confidence Interval, p-value.
1)下面的code对不对?
2)age>20能不能在proc phreg里规定?
3)RACE="B"的coding 对不对?还有没有别的方法?
data b;
set a;
if age>20;
if RACE="A" or RACE="C" or RACE="O" then R=0;
if RACE="B" then R=1;
run;
proc phreg data=b;
model time*censor(0)=age R medhistory/risklimits;
baseline out=temp2 survival=survival;
run; |
d*******o 发帖数: 493 | 2 1)下面的code对不对?
As long as it can be run
2)age>20能不能在proc phreg里规定?
where age>20;
3)RACE="B"的coding 对不对?还有没有别的方法?
You can do dummy variable
B: 0 0
A: 1 0
C: 0 1
D: 1 1 |
t*******0 发帖数: 64 | 3 Race那样coding的话,Race=B不就成了reference cell 了? 程序怎么写呢?
【在 d*******o 的大作中提到】 : 1)下面的code对不对? : As long as it can be run : 2)age>20能不能在proc phreg里规定? : where age>20; : 3)RACE="B"的coding 对不对?还有没有别的方法? : You can do dummy variable : B: 0 0 : A: 1 0 : C: 0 1 : D: 1 1
|
s*******e 发帖数: 1385 | 4 没有太看懂你的race=B是什么意思,是说race这个varible有四个level吗?
【在 t*******0 的大作中提到】 : 对age>20的病人,用Cox model, predictor包括age, RACE="B"(character variable: : e.g. A, B, C, O), medhistory(0,1 variable)。 要找出每个predictor的HR 及 : Confidence Interval, p-value. : 1)下面的code对不对? : 2)age>20能不能在proc phreg里规定? : 3)RACE="B"的coding 对不对?还有没有别的方法? : data b; : set a; : if age>20; : if RACE="A" or RACE="C" or RACE="O" then R=0;
|
t*******0 发帖数: 64 | 5 对的,RACE有4个level: A, B, C, O. 但是Cox proportional regression只要用RACE=
"B" 做predictor。
【在 s*******e 的大作中提到】 : 没有太看懂你的race=B是什么意思,是说race这个varible有四个level吗?
|
t*******0 发帖数: 64 | 6 其实这是一道面试题关于survival analysis,有不同的做法, 当然有不同的答案,
想看看大家是怎么做的, 谢谢! |
t*******0 发帖数: 64 | 7 下周还要去面试, 请大家帮帮忙吧!
【在 t*******0 的大作中提到】 : 其实这是一道面试题关于survival analysis,有不同的做法, 当然有不同的答案, : 想看看大家是怎么做的, 谢谢!
|
d*******o 发帖数: 493 | 8 twitter兄,我看了半天没明白,我猜你是不是这个意思啊
proc phreg data=one;
class race(ref='B');
model time*censor(0)=age R medhistory/risklimits;
hazardratio 'Race' race /diff=ref cl=both;
where age >20;
run; |
t*******0 发帖数: 64 | 9 谢谢你的回复!
题目如下: 对age>20的病人,用Cox model, 要找出每个predictor的HR 及
Confidence Interval, p-value.
predictor包括:
1. age
2. RACE="B"(B代表Africa American)
3. medhistory(0,1 variable)。
我的code如下:我把B(African american)归为一类(R=1), 其他的RACE合在一起为一
类(R=0),不知道这样对不对。你的code为什么把Race="B"作为referen cell? 而你
model后面却用R?
============================================
data b;
set a;
if age>20;
if RACE="A" or RACE="C" or RACE="O" then R=0;
if RACE="B" then R=1;
run;
proc phreg data=b;
model time*censor(0)=age R medhistory/risklimit
【在 d*******o 的大作中提到】 : twitter兄,我看了半天没明白,我猜你是不是这个意思啊 : proc phreg data=one; : class race(ref='B'); : model time*censor(0)=age R medhistory/risklimits; : hazardratio 'Race' race /diff=ref cl=both; : where age >20; : run;
|
d*******o 发帖数: 493 | 10 应该这样吧
proc phreg data=one(where=(age>20));
class race(ref='B') medhistory;
model time*censor(0)=age race medhistory/risklimits;
run; |
|
|
t*******0 发帖数: 64 | 11 太谢谢dapangmao!
不知道为什么要用下面一句?我在SAS里看到class是红色的, 而且run了一下有如下出
错信息: proc phreg 里能用class吗?
113 class RACE(ref='B') medhistory;
-----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
【在 d*******o 的大作中提到】 : 应该这样吧 : proc phreg data=one(where=(age>20)); : class race(ref='B') medhistory; : model time*censor(0)=age race medhistory/risklimits; : run;
|
s*******e 发帖数: 1385 | 12 能用。
【在 t*******0 的大作中提到】 : 太谢谢dapangmao! : 不知道为什么要用下面一句?我在SAS里看到class是红色的, 而且run了一下有如下出 : 错信息: proc phreg 里能用class吗? : 113 class RACE(ref='B') medhistory; : ----- : 180 : ERROR 180-322: Statement is not valid or it is used out of proper order.
|
t*******0 发帖数: 64 | 13 但我试了,有出错信息,过不去,而且没有output
【在 s*******e 的大作中提到】 : 能用。
|
d*******o 发帖数: 493 | |
t*******0 发帖数: 64 | 15 你是不是用的proc tphreg, 而不是proc phreg,能告诉我怎么测试吗? 我用我的
dataset运行通不过,谢谢!!
【在 d*******o 的大作中提到】 : 我测试了一下SAS自带的数据,好像没有问题
|
d*******o 发帖数: 493 | |
t*******0 发帖数: 64 | |
l*********s 发帖数: 5409 | 18 Phreg is a experimental procedure in sas 9.13 and officially incorporated in
9.2. It is very likely the errors are due to the fact that your SAS version
is too old.
【在 t*******0 的大作中提到】 : 多谢dapangmao,我用的是SAS 9.0,是不是版本太低了,所以出错了?
|
t*******0 发帖数: 64 | 19 Thanks littlebirds!
in
version
【在 l*********s 的大作中提到】 : Phreg is a experimental procedure in sas 9.13 and officially incorporated in : 9.2. It is very likely the errors are due to the fact that your SAS version : is too old.
|
t*******0 发帖数: 64 | 20 dapangmao, 谢谢你的回复,我还有一个问题想请教你一下:
我用你的方法,class RACE(ref='B'), 运行出来的output只有RACE不是B的HR,
confidence interval, p-value,却没有RACE='B'的结果。 我想可能是把RACE作为
reference cell的原因。
题目的要求是把RACE='B'作为一个predictor, 而不是作为referece cell, 是不是用
class RACE 就行了?我试了一下,这样的话output里是有RACE='B'的HR, confidence
inteval 和p-value的。想和你确定一下, 这样是不是可以?
万分感谢!!
【在 d*******o 的大作中提到】 : 应该这样吧 : proc phreg data=one(where=(age>20)); : class race(ref='B') medhistory; : model time*censor(0)=age race medhistory/risklimits; : run;
|