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:22:59 -0800
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Properly Flagging items based on multiple conditions
In-Reply-To:  <9b84d790-f8c4-4ed8-97f7-85edfa23507b@21g2000yqj.googlegroups.com>
Content-Type: text/plain; charset=windows-1252

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Sdlentertd > Sent: Wednesday, January 06, 2010 8:42 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Properly Flagging items based on multiple conditions > > 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? \ Something like this will get you started:

data have; input STORE R_NUMBER DAYS date :date9.; 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= have; by store r_number date; run;

data want; set have ; by store r_number;

if first.r_number then GE90 = 0; retain ge90;

if ge90 and days LT 90 then do; flag = 'Y'; ge90 =0; end;

if days GE 90 then ge90 = 1;

drop ge90; run;

Hope this is helpful,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


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