Date: Wed, 16 Apr 2008 12:02:34 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: Transposition Question
In-Reply-To: A<181086.45741.qm@web58505.mail.re3.yahoo.com>
Content-Type: text/plain; charset="us-ascii"
Hi Ash,
Just add TEST to the end of your sorting.
data have;
input Subject test $ visit day value;
cards;
1001 A 1 1 20
1001 A 2 8 25
1001 A 2 9 30
1001 B 1 1 15
1001 B 2 8 20
;
run;
proc sort data=have;
by subject visit day test;
run;
proc transpose data=have out=trans;
by subject visit day;
var value;
id test;
run;
Hope this is helpful.
Mark Terjeson
Senior Programmer Analyst
Investment Management & Research
Russell Investments
Russell Investments
Global Leaders in Multi-Manager Investing
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of ash
us
Sent: Wednesday, April 16, 2008 11:38 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Transposition Question
Hello,
Please help me with this transposition. The data I have is like this
Subject test visit day value
1001 A 1 1 20
1001 A 2 8 25
1001 A 2 9 30
1001 B 1 1 15
1001 B 2 8 20
The data should look like the one below after transposition.
Subject visit day testa testb
1001 1 1 20 15
1001 2 8 25 20
1001 2 9 30 .
I used Proc Transpose using the following code.
proc transpose data=have out=trans;
by subject visit day;
var value;
id test;
run;
I am getting the following error message.
'The ID value 'A' occurs twice in the same BY group'.
How can I do such a transposition?
Thanks
Ash
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.