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 (November 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 28 Nov 2007 17:52:26 -0500
Reply-To:   Ya Huang <ya.huang@AMYLIN.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ya Huang <ya.huang@AMYLIN.COM>
Subject:   Re: Stacking the data
Comments:   To: SUBSCRIBE SAS-L Anonymous <randistan69@HOTMAIL.COM>

data have; input VarA $ VarB $ VarC $; cards; A 10:55 4.55 A 10:56 4.56 B 10:57 5.02 A 10:58 4.53 ;

proc sql; select a.vara,b.varb,a.varc, case when a.vara='A' then b.varb else '' end as vard, case when a.vara='B' then b.varb else '' end as vare from have a, have b where a.vara=b.vara and b.varb <= a.varb ;

VarA VarB VarC vard vare ------------------------------------------------ A 10:55 4.55 10:55 A 10:55 4.56 10:55 A 10:56 4.56 10:56 B 10:57 5.02 10:57 A 10:55 4.53 10:55 A 10:56 4.53 10:56 A 10:58 4.53 10:58

As to the event, there was a post a couple days ago for "numbering subgroup". The solution for that can be used.

On Wed, 28 Nov 2007 17:08:44 -0500, Randy <randistan69@HOTMAIL.COM> wrote:

>The example that I am constructing is that of an auction. "A" and "B" are >events. The first event that occurs is an "A" (Event 1) and it occurs at >10:55 and the price (VarC) is at 4:55. The next event is again "A" (Event >2) at 10:56 and VarC is 4.56. At this point in time (10:56) I need to >know all the events that have occured prior to that point in time. So at >each point in time after each event; I want to know the history of all the >the prior events. That is what i mean by stacking the data. > The next event is "B" which occurs at 10:57. At this point I want to >know the history of all the prior "B" events. At that point in time there >is only one event B that has occured. > Event 4 is an "A' and I want to know the history of the all the "A" >events occuring prior to that point in time. And so on. > I hope that this helps. > Randy. > > >On Tue, 27 Nov 2007 03:38:09 -0800, Tree Frog <tree.frog2@HOTMAIL.COM> >wrote: > >>Hi Randy >> >>Please explain the logic of what you're trying to do. Can you give us >>some clues about what the variables actually mean/represent? At the >>moment, it's entirely unclear what you want to do, what you mean by >>'stack the data', and why you have redundant columns in your output. >> >>Have another go at explaining what you're after. >> >>Tree Frog >> >>On Nov 27, 4:22 pm, randista...@HOTMAIL.COM (Randy) wrote: >>> Dear All: >>> >>> My data set is as follows: >>> >>> VarA VarB VarC >>> A 10:55 4.55 >>> A 10:56 4.56 >>> B 10:57 5.02 >>> A 10:58 4.53 >>> >>> I want to stack the data after each "event" that is VarB. So I want >>> >>> VarA VarB VarC VarD VarE Event >>> A 10:55 4:55 4.55 1 >>> A 10:55 4.55 4.55 2 >>> A 10:56 4.56 4.56 2 >>> B 10:57 5.02 5.02 1 >>> A 10:55 4.55 4.55 3 >>> A 10:56 4.56 4.56 3 >>> A 10.58 4.53 4.53 3 >>> >>> Any help will be appreciated. >>> Randy


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