各位好!
用SAS整理数据过程中发现如下问题,请教下大家:[img=0,1]file:///C:/Documents%20and%20Settings/Administrator/Application%20Data/Tencent/Users/499707227/QQ/WinTemp/RichOle/VYZIS%5YP[R83~0W33M4GLT.jpg[/img]
y1 | y2 | y3 | tp |
1 | . | 3 | 3 2 |
. | . | . | 1 . |
. | . | 1 | 2 1 |
data c;set b;if y1=y2=y3 then tp=1;
if y1=y2^=y3 then tp=2;
if y1=y3^=y2 then tp=2;
if y2=y3^=y1 then tp=2;
if y1^=y2^=y3 then tp=3;run;
我用以上程序可以得到表格中黑色数字类型,其实我是想得到标红的数字类型,具体来讲就是y1-y3中有一个数字那么tp为1如表格第三行,空值不算!
我的程序应该怎么写了,请赐教!谢谢!
[img]file:///C:\Documents and Settings\Administrator\Application Data\Tencent\Users\499707227\QQ\WinTemp\RichOle\VYZIS%5YP[R83~0W33M4GLT.jpg[/img]