sas 组内序列号
作者:互联网
ID | var1 | var2 |
01 | Y | Cancer |
01 | Y | Death |
01 | Y | Prolongs Hospitalization |
01 | Y | Life Threatening |
02 | N | Overdose |
02 | N | Death |
02 | N | Disability |
02 | N | Cancer |
02 | N | Other |
ID | ID1 | var1 | var2 |
01 | 1 | Y | Cancer |
01 | 2 | Y | Death |
01 | 3 | Y | Prolongs Hospitalization |
01 | 4 | Y | Life Threatening |
02 | 1 | N | Overdose |
02 | 2 | N | Death |
02 | 3 | N | Disability |
02 | 4 | N | Cancer |
02 | 5 | N | Other |
数据管理:插入新变量ID1:按ID分组,每组用ID1顺序编号(如表2);table1数据集命名为ae,table1数据集命名为ae1。
sample sas code:
proc sort data=ae out=ae0;
by id;
run;
data ae1;
set ae0;
by id;
if first.id then id1=1;
else id1+1;
run;
标签:02,Death,Cancer,组内,ID,01,sas,序列号,id 来源: https://www.cnblogs.com/xyqhy/p/11276646.html