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 (January 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Jan 2010 09:33:32 -0800
Reply-To:     Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Tom Abernathy <tom.abernathy@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Properly Flagging items based on multiple conditions
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Try something like this:

data old; informat date date9.; format date date9.; input store r_number days date; cards; 1212 456 20 01jan2010 1212 468 90 01jan2010 1212 456 90 02jan2010 1212 468 30 02jan2010 2566 468 10 03jan2010 1212 456 30 04jan2010 run;

proc sort data=old ; by store r_number date; run;

data new; set old; by store r_number ; retain flag 0; lag_days=lag(days); if first.r_number then flag=0; else if (.Z < days < 90) and (lag_days ge 90) then flag=1; put store r_number days date flag; run;

1212 456 20 01JAN2010 0 1212 456 90 02JAN2010 0 1212 456 30 04JAN2010 1 1212 468 90 01JAN2010 0 1212 468 30 02JAN2010 1 2566 468 10 03JAN2010 0

On Jan 6, 11:41 am, Sdlentertd <sdlente...@gmail.com> wrote: > On Jan 5, 2:11 pm, Sdlentertd <sdlente...@gmail.com> wrote: > > > > > > > I have this dataset and I am looking to flag items for the same store > > with the same R-number but that went from =>90 to <90 on days > > > Have: > > STORE R-NUMBER DAYS date > > 1212 456 20 01jan2010 > > 1212 468 90 01jan2010 > > 1212 456 90 02jan2010 > > 1212 468 30 02jan2010 > > 2566 468 10 03jan2010 > > 1212 456 30 04jan2010 > > > So first I need to look at the stores to make sure I am analyzing the > > same store, then I am looking at R-Number and if it's the same then > > look at DAYS and Date, if it went from 90 to less (based on Date) then > > Flag it. > > > Want: > > STORE R-NUMBER DAYS date FLAG > > 1212 456 20 01jan2010 > > 1212 468 90 01jan2010 Y > > 1212 456 90 02jan2010 > > 1212 468 30 02jan2010 > > 2566 468 10 03jan2010 > > 1212 456 30 04jan2010 Y > > > (the last one is Y because at first it was 20 then it went to 90 and > > then went DOWN to 30) > > Thanks for any help > > Anyone?- Hide quoted text - > > - Show quoted text -


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