[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Proc Transpose Question
From: shantanu Chandra <shantanuchandra () HOTMAIL ! COM>
Date: 2004-12-31 18:35:10
[Download RAW message or body]
Hi everybody,
I am stuck trying to transpose a dataset:
I have a dataset that looks like:
Obs Account amt cnt industry
1 1291 22.8 1 1
2 1291 34.55 2 6
3 1291 11.78 1 1
4 1291 24.12 1 7
5 1291 347.18 8 8
6 1788 607 3 9
7 1788 83.14 2 6
8 1788 245.58 1 9
9 1788 7.15 1 7
10 1788 94.09 1 8
I want it to look like this:
account amt_1 amt_2....... ..... ..cnt_1 cnt_2 .....
1291
1788
so basically the table needs to be transposed once for amounts for
id=industry and then for count for id=industry
I am right now doing it in two transpose statements like:
data a(drop=amount) b(drop=count); set temp1(obs=1000); run;
proc transpose data=a out=temp2 prefix=cnt_;
by account;
id industry;
var count;
run;
proc transpose data=b out=temp3 prefix=amt_;
by account;
id industry;
var amount;
run;
data c; merge temp2 temp3;
by account;
run;
Is there a more direct way of doing this ?
Thanks a wish everybody a Happy new Year !
Shantanu
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic