s******y 发帖数: 64 | 1 两个variables:RESP, SCORE
RESP is set to 0 or 1, based on SCORE is 0 or >0
sas程式写成 RESP=(SCORE gt 0)而不是IF...THEN的形式。
请问有人知道这是什么用法?
SAS online doc哪章节能找到这种用法的介绍?
谢谢! |
D******n 发帖数: 2836 | 2 本来就是这种用法,任何语言都有这种用法。
【在 s******y 的大作中提到】 : 两个variables:RESP, SCORE : RESP is set to 0 or 1, based on SCORE is 0 or >0 : sas程式写成 RESP=(SCORE gt 0)而不是IF...THEN的形式。 : 请问有人知道这是什么用法? : SAS online doc哪章节能找到这种用法的介绍? : 谢谢!
|
m******4 发帖数: 26 | 3 indicator=(logical condition)
indicator=1 if logical condition is true
indicator=0 if logical condition is false.
【在 s******y 的大作中提到】 : 两个variables:RESP, SCORE : RESP is set to 0 or 1, based on SCORE is 0 or >0 : sas程式写成 RESP=(SCORE gt 0)而不是IF...THEN的形式。 : 请问有人知道这是什么用法? : SAS online doc哪章节能找到这种用法的介绍? : 谢谢!
|
t******n 发帖数: 91 | 4 这是个逻辑判断的用法,()里是expression, 真赋1,假赋0,
算sas中逻辑运算法则吧 |
s******y 发帖数: 64 | 5 SAS online doc哪章节能找到这种用法的介绍?
需要扫盲一下下。
thanks! |
D******n 发帖数: 2836 | 6 told u it is not unique to SAS
almost all programming language can do this.
You can do this because >,= and < are just operators like + - * /, it will g
ive you a retruned value.
compare
y = x+1
and
y = x >1
u can do sth like y = (x<=1)+ x *((x<9) + 3)
there is a trick for assigning alternative values
y = (x>cutoff)*val1 + (x<=cutoff)*val2
【在 s******y 的大作中提到】 : SAS online doc哪章节能找到这种用法的介绍? : 需要扫盲一下下。 : thanks!
|
R*********i 发帖数: 7643 | 7 You need to be careful if you don't want to assign RESP to 0 when score has
the missing value. |
l*********s 发帖数: 5409 | 8 Yeah, R's treatment is much more sensible.
has
【在 R*********i 的大作中提到】 : You need to be careful if you don't want to assign RESP to 0 when score has : the missing value.
|
s******y 发帖数: 64 | |
R*********i 发帖数: 7643 | |