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 (October 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 27 Oct 2010 16:51:27 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Concatenating a field for each ID
Comments: To: toby dunn <tobydunn@hotmail.com>
In-Reply-To:  <BAY123-W48E6B0205A60452CF47645DE430@phx.gbl>
Content-Type: text/plain; charset=windows-1252

Why do you need to increment a counter that you don't use?

Do I = 1 By 1

On Wed, Oct 27, 2010 at 4:47 PM, toby dunn <tobydunn@hotmail.com> wrote: > It is about as easy as this: > > Data Have ; > Infile Cards ; > Input ID Flag ; > Cards ; > 1 3 > 1 4 > 2 1 > 2 5 > 3 4 > ; > Run ; > > Data Need ( Keep = ID Flag ) ; > Length Flag $ 20 ; > > Do I = 1 By 1 Until( Last.ID ) ; > Set Have ( Rename = ( Flag = _Flag ) ) ; > By ID ; > Flag = CatX( ',' , Flag , _Flag ) ; > End ; > > Run ; > > > Toby Dunn > > > "I'm a hell bent 100% Texan til I die" > > "Don't touch my Willie, I don't know you that well" > > > > >> Date: Wed, 27 Oct 2010 16:20:44 -0400 >> From: harrypotterdhf@EARTHLINK.NET >> Subject: Concatenating a field for each ID >> To: SAS-L@LISTSERV.UGA.EDU >> >> I have a dataset with id’s which might have more than 1 flag. I would like >> to concatenate the flags for each id into new field. What is the best way to >> accomplish this? Thanks! >> >> Input: >> >> id flag >> -- ---- >> 1 3 >> 1 4 >> 2 1 >> 2 5 >> 3 4 >> >> Desired output: >> >> id flag >> -- ---- >> 1 3, 4 >> 2 1, 5 >> 3 4 >


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