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 (August 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 21 Aug 2002 06:34:20 -0700
Reply-To:   Lily Huang <lily6935@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lily Huang <lily6935@YAHOO.COM>
Subject:   Re: How to use array to transpose variable values as columns
In-Reply-To:   <OF834E5B52.C6AB8A70-ONC1256C1C.0048CE8C@qffm.quintiles.com>
Content-Type:   text/plain; charset=us-ascii

Thanks for all your reply. Yes, I should use transpose to do this. For some reason, I was stuck with array at the time I was thinking about doing this. It is much easier using transpose do this.

--- Christoph.Helwig@quintiles.com wrote: > > data a; > input id name $1.; > cards; > 1 a > 1 b > 1 c > 1 d > 2 a > 2 c > 3 d > 3 c > 3 a > 5 e > ; > run; > > proc transpose out=b prefix=name; > by id; > var name; > run; > > > > > > lily padula <lily6935@YAHOO.COM>@LISTSERV.UGA.EDU> > on 21/08/2002 14:57:44 > > Please respond to lily padula <lily6935@YAHOO.COM> > > Sent by: "SAS(r) Discussion" > <SAS-L@LISTSERV.UGA.EDU> > > > To: SAS-L@LISTSERV.UGA.EDU > cc: (bcc: Christoph Helwig/QFFM/Quintiles) > > Subject: How to use array to transpose variable > values as columns > > > I have the following data set: > > > data a; > input id name $1.; > cards; > 1 a > 1 b > 1 c > 1 d > 2 a > 2 c > 3 d > 3 c > 3 a > 5 e > ; > run; > > And I would like to have a data set to be organized > like this: > > id name1 name2 name3 name4 > 1 a b c d > 2 a c > 3 d c a > 5 e > > In other words, the id is a random number and each > id could have n names. > I > would like to create a file that has one row for > each id and transpose the > value of variable 'name' into coulumns, named as > name1, name2, name2, and > etc. > > Any idea about this? Thanks in advance. > > Lily > > > > > > > > > > > ************************************************************************************************** > The contents of this email and any attachments are > confidential. > It is intended for the named recipient(s) only. > If you have received this email in error please > notify the system manager or the > sender immediately and do not disclose the contents > to any one or make copies. > > ** eSafe scanned this email for viruses, vandals and > malicious content ** > ************************************************************************************************** >

__________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com


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