由买买提看人间百态

topics

全部话题 - 话题: crop4
(共0页)
l*****o
发帖数: 61
1
来自主题: Statistics版 - 怎么样用SAS把几列数据并成一列?
有一组数据,变量名为Y, crop1, crop2, crop3, crop4.我想把数据重新排成Y
replication crop。其中变量crop包括所有crop1-crop4,那个新变量replication是1-
4, 1代表如果是crop1,2代表如果是crop2, 3代表如果是crop3,4代表如果是crop4.
用是SAS咋弄啊?谢谢!!!
g**u
发帖数: 205
2
来自主题: Statistics版 - 怎么样用SAS把几列数据并成一列?
data a;
set b;
replication=1; crop=crop1;output;
replication=2; crop=crop2;output;
replication=3; corp=crop3;output;
replication=4; corp=crop4;output;
run;
like this?
Try if it works.
T*******I
发帖数: 5138
3
来自主题: Statistics版 - 怎么样用SAS把几列数据并成一列?
Generate a new variable named Corp in a Data step:
Corp=Corp1||Crop2||Crop3||Crop4;
for example if Obs=3 has following records
Obs Y Corp1 Corp2 Corp3 Corp4
3 y3 C13 C23 C33 C43
Then you will have:
Obs Y Corp1 Corp2 Corp3 Corp4 Corp
3 y3 C13 C23 C33 C43 C13C23C33C43
Is it what you want to have?

1-
(共0页)