Date: Mon, 17 Dec 2007 06:10:13 -0800
Reply-To: lorddoyle@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: lorddoyle@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: help flattening data
Content-Type: text/plain; charset=ISO-8859-1
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 -
|