Date: Wed, 20 Dec 2006 11:09:05 -0800
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Transposing data
Content-Type: text/plain; charset="us-ascii"
Hi,
Here is one approach:
data sample;
input Acno FrNo1 Frno2 Frno3 Fred1 Fred2 Fred3;
cards;
1 1 2 3 1 3 2
2 4 5 6 7 8 9
;
run;
proc transpose data=sample out=temp1(rename=(col1=Frno));
by Acno;
var FrNo:;
run;
proc transpose data=sample out=temp2(rename=(col1=Fred));
by Acno;
var Fred:;
run;
data result(drop=_name_);
merge temp1 temp2;
by Acno;
run;
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group
Russell
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Chirag Taneja
Sent: Wednesday, December 20, 2006 10:56 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Transposing data
Hi,
Can you guys please help me out with a simple transposing problem .
I have a dataset like this:
Ac no FrNo1 Frno2 Frno3 Fred1 Fred2 Fred3
1 1 2 3 1 3 2
2 4 5 6 7 8 9
I want output like this
Ac no Frno Fredno
1 1 1
1 2 3
1 3 2
2 4 7
2 5 8
2 6 9
Thanks