Date: Mon, 17 Oct 2011 06:43:48 -0400
Reply-To: Nat Wooding <nathani@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nat Wooding <nathani@VERIZON.NET>
Subject: Re: Groupings Correct?
In-Reply-To: <201110170506.p9H4ImmV008207@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Randy
You needed to make your grouping counter dependent on the change in the
values of date:
Data need ; set have ;
by VarA VarB Date ;
if first.VarA then Group = 0;
if first.Date then Group + 1 ;** change here;
run;
Nat Wooding
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Randy
Sent: Monday, October 17, 2011 1:06 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Groupings Correct?
Dear All:
My data is as follows
VarA VarB VarC Date
X A 1 01OCT2011
X A 2 01OCT2011
X A 5 02OCT2011
X B 9 01OCT2011
X B 15 01OCT2011
X B 4 01OCT2011
X B 6 02OCT2011
X B 8 02OCT2011
X B 9 02OCT2011
The Data I need is
VarA VarB VarC Date Group
X A 1 01OCT2011 1
X A 2 01OCT2011 1
X A 5 02OCT2011 2
X B 9 01OCT2011 3
X B 15 01OCT2011 3
X B 4 01OCT2011 3
X B 6 02OCT2011 4
X B 8 02OCT2011 4
X B 9 02OCT2011 4
I wrote:
Data need ; set have ;
by Date VarA VarB;
if first.VarA then Group = 0;
Group + 1 ;
run;
What is the mistake that I am Making?
Randy