Date: Mon, 17 Dec 2007 14:50:21 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: help flattening data
In-Reply-To: <0fb44230-5e46-4fac-8c29-00182c9ddae3@c4g2000hsg.googlegroups.com>
Content-Type: text/plain; charset="Windows-1252"
Since I can think of a dozen different ways one would want the final data structure show us an input example and what you want the resulting data structure to look likeToby Dunn "Don't bail. The best gold is at the bottom of barrels of crap." Randy Pausch "Be prepared. Luck is where preparation meets opportunity." Randy Pausch> Date: Mon, 17 Dec 2007 06:10:13 -0800> From: lorddoyle@GMAIL.COM> Subject: Re: help flattening data> To: SAS-L@LISTSERV.UGA.EDU> > Thanks, this works great. Is there any way to do this with multiple> variables at a time. For example, if there was another column that I> would want to flatten as well.> > > On Dec 14, 3:36 pm, tobyd...@HOTMAIL.COM (toby dunn) wrote:> > Proc Transpose> > Data = Hula> > Out = Need ( Drop = _Name_ ) Prefix = Value ;> > By Hula Year ;> > Var Value ;> > Run ;> >> > Toby Dunn> >> > "Don't bail. The best gold is at the bottom of barrels of crap."> > Randy Pausch> >> > "Be prepared. Luck is where preparation meets opportunity."> > Randy Pausch> >> >> >> >> >> > > Date: Fri, 14 Dec 2007 13:21:06 -0800> > > From: lorddo...@GMAIL.COM> > > Subject: help flattening data> > > To: SA...@LISTSERV.UGA.EDU> >> > > Here's the deal, I have a data set that i need to flatten out. By this> > > I mean I have something like this:> >> > > data hula;> > > input hula year value ;> > > cards;> > > 1 96 40000> > > 2 96 40500> > > 3 96 41000> > > 3 96 45000> > > ;> > > run ;> >> > > and I want it to look like this:> >> > > data hula2;> > > input hula year value1 value2 ;> > > cards;> > > 1 96 40000 .> > > 2 96 40500 .> > > 3 96 41000 45000> > > ;> > > run ;> >> > > my idea is to run it through a data step using hula as the byvariable> > > to create another column that records the number of distinct hula> > > values. The result should look like:> >> > > data hula3;> > > input hula count year value ;> > > cards;> > > 1 1 96 40000> > > 2 1 96 40500> > > 3 1 96 41000> > > 3 2 96 45000> > > ;> > > run ;> >> > > Then use proc transpose to get flatten the data.> >> > > Could someone help with a way to create the count column?> >> > _________________________________________________________________> > Don't get caught with egg on your face. Play Chicktionary!http://club.live.com/chicktionary.aspx?icid=chick_wlhmtextlink1_dec- Hide quoted text -> >> > - Show quoted text -
_________________________________________________________________
i’m is proud to present Cause Effect, a series about real people making a difference.
http://im.live.com/Messenger/IM/MTV/?source=text_Cause_Effect |