j***3 发帖数: 142 | 1 table 1
categories location
A M
A H
B M
B H
C M
C H
。
。
。
table 2
location categories_A categories_B categories_C 。。。。。
M 100 300 500
H 300 700 109
。
。
。
想从 table 1 和 table 2 得到
table 3
categories location value
A M 100
A H 300
B M 300
B H 700
C | f*******e 发帖数: 51 | 2 transpose table 2 就可以了
【在 j***3 的大作中提到】 : table 1 : categories location : A M : A H : B M : B H : C M : C H : 。 : 。
| z*****h 发帖数: 17 | 3 data table2(drop=i temp);
set table2;
array cat categories_A categories_B categories_C;
do i=1 to dim(cat);
value=cat[i];
call vname(cat[i],temp);
categories=substr(temp,12,1);
output;
end;
run; | z**k 发帖数: 378 | 4 人家说的是Mysql,不是SAS吧
【在 z*****h 的大作中提到】 : data table2(drop=i temp); : set table2; : array cat categories_A categories_B categories_C; : do i=1 to dim(cat); : value=cat[i]; : call vname(cat[i],temp); : categories=substr(temp,12,1); : output; : end; : run;
|
|