Date: Sat, 27 Jan 2007 22:53:50 -0500
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: Comparing date variable
On Wed, 24 Jan 2007 04:29:29 -0800, hema <hema_dave15@YAHOO.COM> wrote:
>Thanks Toby.. Can you help me on this ?
>
> Customer Basket Item Basketdate c1 1
b 31-Jan-04 c1 1 a 31-Jan-04 c1 1 b
31-Jan-04 c1 2 a 6-Nov-04 c1 2
a 6-Nov-04 c1 2 b 6-Nov-04 c1 2
b 6-Nov-04 c1 3 a 14-Feb-05 c1 3 b
14-Feb-05 c1 4 a 31-Dec-06 c1 4 b
31-Dec-06 c2 1 a 29-Nov-04 c2 2 a
15-Mar-05 c2 3 b 9-Sep-05 c2 3 b
9-Sep-05 c2 3 b 9-Sep-05 c2 3 a
9-Sep-05 c2 4 a 25-Dec-06 c2 4 a
25-Dec-06 c2 4 a 25-Dec-06 c2 4 b
25-Dec-06
>
>
>Say,This is the data i have.I have a sequence that a :) b .i.e "a" preceeds
"b" .
> I want to three revenues to be calculated. Revenue of a,revenue of b ,
and revenue of a,b . this is with respect to customer.
> Revenue of "a" will be sum of revenue of a where "a" has occured before "b".
> Similarly Revenue of "b" will be the sum of revenue of b where b has
occured after "a".
> Revenue of "a","b" will be sum of revenue of a and b given the fact that
"a" preceeds "b".
>
> In short, Adding the revenue of all "a" which has "b" following. even if
one "b" follows 5 "a"'s i would want revenue of all 5 "a"'s summed
.Similarly, i want revenue of all "b" following "a".
> Only one point to be remembered is that for the first time when "a"
appears, in that basket revenue of "b" is considered and the basket which
has last count of "b" , revenue of "a" if "a" is present in that basket,
is not considered.
>
> Can you help on this?
>
> Regards,
> Hema
[snip]
I can help just by un-munging your post so that the table appears as such
and there is a little whitespace.
Customer Basket Item Basketdate
c1 1 b 31-Jan-04
c1 1 a 31-Jan-04
c1 1 b 31-Jan-04
c1 2 a 6-Nov-04
c1 2 a 6-Nov-04
c1 2 b 6-Nov-04
c1 2 b 6-Nov-04
c1 3 a 14-Feb-05
c1 3 b 14-Feb-05
c1 4 a 31-Dec-06
c1 4 b 31-Dec-06
c2 1 a 29-Nov-04
c2 2 a 15-Mar-05
c2 3 b 9-Sep-05
c2 3 b 9-Sep-05
c2 3 b 9-Sep-05
c2 3 a 9-Sep-05
c2 4 a 25-Dec-06
c2 4 a 25-Dec-06
c2 4 a 25-Dec-06
c2 4 b 25-Dec-06
>Say,This is the data i have.
>I have a sequence that a :) b .i.e "a" preceeds "b" .
>I want to three revenues to be calculated. Revenue of a,revenue of b , and
revenue of a,b . this is with respect to customer. Revenue of "a" will be
sum of revenue of a where "a" has occured before "b". Similarly Revenue of
"b" will be the sum of revenue of b where b has occured after "a". Revenue
of "a","b" will be sum of revenue of a and b given the fact that "a"
preceeds "b".
>In short, Adding the revenue of all "a" which has "b" following. even if
one "b" follows 5 "a"'s i would want revenue of all 5 "a"'s summed
.Similarly, i want revenue of all "b" following "a".
>Only one point to be remembered is that for the first time when "a"
appears, in that basket revenue of "b" is considered and the basket which
has last count of "b" , revenue of "a" if "a" is present in that basket, is
not considered.
A bit easier to read, no?
However, there is no REVENUE variable to sum.
Perhaps you can re-post and include such a variable as well as the expected
results.