LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 30 Mar 2006 18:02:51 -0500
Reply-To:     Rushi Patel <rushi.b.patel@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Rushi Patel <rushi.b.patel@GMAIL.COM>
Subject:      Re: horizontal data into vertical
Comments: To: toby dunn <tobydunn@hotmail.com>
In-Reply-To:  <BAY101-F239E18EE842BBAF1E4CCA6DED10@phx.gbl>
Content-Type: text/plain; charset=ISO-8859-1

Thanks Toby,

Does the trick..

Rushi

On 3/30/06, toby dunn <tobydunn@hotmail.com> wrote: > Rushi , > > data one ; > infile cards ; > input id a1992 b1992 $ a1993 b1993 $ a1994 b1994 $ ; > cards ; > 1 10 VR 10 VR 20 RV > 2 20 VR 25 RV 30 XX > ; > run ; > > proc transpose > data = one > out = two ; > by id ; > var a: b: ; > run ; > > > data two ( drop = _Name_ ) ; > set two ; > Year = Substr(_Name_ , 2 ) ; > run ; > > > proc sort > data = two ; > by Id Year ; > run ; > > proc transpose > data = two > out = three ( drop = _Name_ rename = ( Col1 = A Col2 = B ) ) ; > by id Year ; > var COl1 ; > run ; > > > proc print > data = three ; > run ; > > > > Toby Dunn > > > > > > From: Rushi Patel <rushi.b.patel@GMAIL.COM> > Reply-To: Rushi Patel <rushi.b.patel@GMAIL.COM> > To: SAS-L@LISTSERV.UGA.EDU > Subject: horizontal data into vertical > Date: Thu, 30 Mar 2006 17:26:58 -0500 > > SAS-L, > > I an interested in transforming the following horizontal data into > vertical.. > > id a1992 b1992 a1993 b1993 > a1994 b1994 > 1 10 VR 10 VR > 20 RV > 2 20 VR 25 RV > 30 XX > .... > > into > > id year a b > 1 1992 10 VR > 1 1993 10 VR > 1 1994 20 RV > 2 1992 20 VR > 2 1993 25 RV > 2 1994 30 XX > > I tried > > PROC TRANSPOSE data = dat1 out = out1; > by id; > var a1992 - a1994 b1992 - b1994; > run; > > but this would give both a and b under one column. > > Thanks, > > Rushi > > >


Back to: Top of message | Previous page | Main SAS-L page