|
John Doe,
Not too sure why you want yoru data this way but hey to each their own.
data one ;
infile cards ;
input week $ name $ A $ B $ Value ;
cards ;
01 shoes a1 b1 120
02 shoes a2 b2 80
;
run ;
proc transpose
data = one
out = two (drop = _name_) prefix = Week_ ;
by week ;
var Value ;
id week ;
copy name A B ;
run ;
proc print
data = two ;
run ;
Toby Dunn
Hello,
i would like to break down some values in columns. Let's look the
picture:
What i have:
---------------------------------
| week | name | a | b | value |
---------------------------------
| 02 | shooes | a1| b1| 120 $ |
| 01 | ... | a2| b2| 80 $ |
What i want:
----------------------------------------
| name | a | b | week_01 | week_02 | ...
-----------------------------------------
| shooes | a1| b1| . | 120 $ | ...
| ... | a2| b2| 80 $ | . | ...
* i don't know how many week there is (this will change with time,
because in the real data, the year is included)
* off course, the week values are not unique
I've tried
- transpose : without success
- array : you need to know the name of the new column in advance
Any help really appreciated
|