A***8 发帖数: 189 | 1 data structure列在下面啦,哪位达人能帮着看一下怎么从1变到2,从2变到1。
包子酬谢!
dataset1:
index var1 var1_description var2 var2_description
1 cd02 cd02_text cd05 cd05_text
2 cd05 cd05_text cd03 cd03_text
3 cd03 cd03_text cd04 cd04_text
4 cd10 cd10_text cd08 cd08_text
dataset2:
index var description
1 cd02 cd02_text
1 cd05 cd05_text
2 cd05 cd05_text
2 cd03 cd03_text
3 cd03 cd03_text
3 cd04 cd04_text
4 cd10 cd10_text
4 cd08 cd08_text |
w*******9 发帖数: 1433 | 2 1-->2: 对transpose不熟,有一个很笨的方法,取俩subset再append。要求按原来的顺
序的话,给原数据加一列标示obs id.
2-->1: 先output成俩subset,再用sql语句merge。 |
t*****w 发帖数: 254 | 3 data set2 (keep=x1 x2);
set set1 ;
array y1{2} $ var1 var1_description;
array y2{2} $ var2 var2_description;
x1=y1{1};
x2=y1{2};
output;
x1=y2{1};
x2=y2{2};
output;
run;
【在 A***8 的大作中提到】 : data structure列在下面啦,哪位达人能帮着看一下怎么从1变到2,从2变到1。 : 包子酬谢! : dataset1: : index var1 var1_description var2 var2_description : 1 cd02 cd02_text cd05 cd05_text : 2 cd05 cd05_text cd03 cd03_text : 3 cd03 cd03_text cd04 cd04_text : 4 cd10 cd10_text cd08 cd08_text : dataset2: : index var description
|
j******o 发帖数: 127 | 4 data have;
input index var1 $ var1_description $ var2 $ var2_description $;
datalines;
1 cd02 cd02_text cd05 cd05_text
2 cd05 cd05_text cd03 cd03_text
3 cd03 cd03_text cd04 cd04_text
4 cd10 cd10_text cd08 cd08_text
;
run;
data obtain;
set have(keep=index var1 var1_description rename=(var1=var var1_
description=description))
have(keep=index var2 var2_description rename=(var2=var var2_
description=description));
by index;
run; |