0
我有下面的示例数据:将基于值的新列
data weight_club;
input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;
Loss = StartWeight - EndWeight;
datalines;
1023 David Shaw red 189 165
1049 Amelia Serrano yellow 145 124
1219 Alan Nance purple 210 192
1246 Ravi Sinha yellow 194 177
1078 Ashley McKnight green 127 118
;
我想现在要做的是以下几点:
- 颜色创建两个列表(FE,列表1 =“红色”和“黄色”和列表2 =“紫色”和“绿色”)
- 根据它们是否在list1和list2中分类记录并添加新列。
所以伪代码是这样的:
'Set new category called class
If item is in list1 then class = 1
Else if item is in list2 then class = 2
Else class = 3
我如何能做到这一点最有效牙缝有什么想法?