y*****i 发帖数: 3 | 1 Sorry I can't input Chinese with this computer...
and thank you for taking a look,
and here is my challenge:
I want to add new a numeric column 'newcol' to tb1,
and the value of newcol will be decided by item:
if item is 'A' then newcol take valA;
if item is 'B' then newcol take valB;
...
tb1 has 32 columns:
time item valA valB valC valD valE valF....valAD
t1 A 0.1 0.2 . . 0.4
t1 B . . 0.1 0.2 . . 0.4
t1 c . 0.2 0.3 . . . 0.4
.
.
.
t10 | f********t 发帖数: 117 | 2 selct *, case when item = A then valA
when item = B then valB
..
end as newcol
from tb1
I didnt test this in sas, but it should work in sql. |
|