Date: Tue, 8 Sep 2009 05:15:35 -0700
Reply-To: Steve Steve <steve11145@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Steve Steve <steve11145@YAHOO.COM>
Subject: Re: SQL - transpose
In-Reply-To: <29dd68ea-e676-489a-8f8b-62af0a0f77da@y42g2000yqb.googlegroups.com>
Content-Type: text/plain; charset=iso-8859-1
Thanks all for your help!
________________________________
From: Richard A. DeVenezia <rdevenezia@gmail.com>
To: Steve Steve <steve11145@yahoo.com>
Cc: SAS-L@listserv.uga.edu
Sent: Tuesday, September 8, 2009 7:44:34 PM
Subject: Re: SQL - transpose
On Sep 8, 4:35 am, steve11...@YAHOO.COM (Steve Steve) wrote:
> Please help with the following:
>
> data have;
> input a1 a2 a3 team $;
>
> cards;
> 100 300 500 tm1
> 200 400 600 tm1
> ;
> run;
>
> data want by SQL:
>
> tm1 tm2
> a1 100 200
> a2 300 400
> a3 500 600
>
> Please note that the numbers are dynamic.
SQL is not a tool typically used for transposition -- certain types of
data structures can be transposed via wallpaper code and/or code
generation.
Please tell your boss or professor it's a dead end,
Proc TRANSPOSE is one of the better tools.
--------------------------------
data have;
input a1 a2 a3 team $;
rowid+1;
datalines;
100 300 500 tm1
200 400 600 tm1
run;
proc transpose data=have out=want prefix=TM;
var a:;
run;
--------------------------------
Richard A. DeVenezia
http://www.devenezia.com
|