Date: Tue, 8 Sep 2009 04:44:34 -0700
Reply-To: "Richard A. DeVenezia" <rdevenezia@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@GMAIL.COM>
Subject: Re: SQL - transpose
In-Reply-To: <972344.11282.qm@web111906.mail.gq1.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1
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