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 (February 2007, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 8 Feb 2007 13:06:31 -0800
Reply-To:     Syb it <sas_datalover@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Syb it <sas_datalover@YAHOO.COM>
Subject:      Re: Sum days
Comments: To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
In-Reply-To:  <455E5B258922154FBE497F58237915C604A9E56B@XCH-NW-8V2.nw.nos.boeing.com>
Content-Type: text/plain; charset=iso-8859-1

Barry,

George Hurley pretty much solved the problem in an earlier post. If you are interested look at the solution below: If the first check was on MArch 1st, and assuming march has 31 days.. then by April 1st, this person should be back for check no 2. If they show up on April 16 they are all those days.. so the answer to ur question is. It depends on the starting point and the next expected pick up date. Assumption is that if u dont pick it up you might DIE of hunger ($1 a day or else) ;)

Try something this:

data days_late; input id date_pick_check:date7. inc_days @@; format date_pick_check date7.; cards; 1 01-Jan-00 31 1 03-Feb-00 28 1 04-Mar-00 31 1 27-Mar-00 30 1 01-May-00 31 2 01-Mar-01 31 3 01-Jun-03 30 3 10-Jul-03 31 3 01-Aug-03 30 3 01-Sep-03 31 4 01-Apr-99 30 4 05-May-99 31 4 01-Jun-99 30 ; run; proc print; run;

proc sort data=days_lateb; by id date_pick_check; run;

data days_lateb; set days_late; by id; k=date_pick_check+0; y=lag(date_pick_check); z=lag(inc_days); if not first.id then do; diff=date_pick_check-y; end; late=diff-z; run;

proc sql; select id, sum(late) as totlate from days_lateb where late>0 group by id; quit;

"Schwarz, Barry A" <barry.a.schwarz@BOEING.COM> wrote: How do you know which of observations 3 and 4 is "late March" and which is "early April"? Given a date of 16 April, is it 15 days late or 15 days early? Is a 2 June date 1 day late for June or 32 days late for May?

-----Original Message----- From: Syb it [mailto:snip] Sent: Thursday, February 08, 2007 11:22 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Sum days

Dear All, date_ pick_ Obs id check inc_days

1 1 01JAN00 31 2 1 03FEB00 28 3 1 04MAR00 31 4 1 27MAR00 30 5 1 01MAY00 31 6 2 01MAR01 31 7 3 01JUN03 30 8 3 10JUL03 31 9 3 01AUG03 30 10 3 01SEP03 31 11 4 01APR99 30 12 4 05MAY99 31 13 4 01JUN99 30 Questions:

I am trying to figure out on average how late a person is to pick up their check. Consider person # 1 for example: (a) five checks were picked at given dates (b) Check is supposed to last a given month ($1/day) They picked up their 1st check on 01jan00, then 2nd on Feb 3rd. This person was late to pick up their second check by 2 days because each dollar lasts a day (that's the assumption). Now I need to sum for each person how late they would have been considering all check they would have picked up (all records). NB: Checks can be collected earlier before the previous one is depleted (for example on 27 March for Id=1) was an early pick up.

Please help with some code ;)

data days_late; input id date_pick_check:date7. inc_days @@; format date_pick_check date7.; cards; 1 01-Jan-00 31 1 03-Feb-00 28 1 04-Mar-00 31 1 27-Mar-00 30 1 01-May-00 31 2 01-Mar-01 31 3 01-Jun-03 30 3 10-Jul-03 31 3 01-Aug-03 30 3 01-Sep-03 31 4 01-Apr-99 30 4 05-May-99 31 4 01-Jun-99 30 ; run; proc print; run;

--------------------------------- Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.


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