Date: Thu, 9 Oct 2008 14:40:34 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: calculate last day to start vacation
On Thu, 9 Oct 2008 19:24:26 +0300, gbb
<ldkdfgfgdsfgddstwefjgjdfgjdfjgjfdjgfdgjdfjgkjdfkjglkfjdglkdjfgkljfdgjdkjgk
djglkjdlkgjlkdjgn_f@HC.BF> wrote:
>suppose I know the number of vacation hours remaining for the year, ie. 16
>
>suppose I also know that since each 8 hour block equals 1 day, then 16 /
8 =
>2 days remaining
>
>some people are coded to work a weekday(2,3,4,5,6) Mo-Fr schedule, others
>may have Su, Sa
>
>how could I calculate the absolute start time for their annual vacation,
>using the above knowledge?
>
>to illustrate
>
>data temp;
> input schedule hours; * schedule 1 = Mo-Fr, 2=Tu-Sa, 3=Sa,Su, Mo-We ;
>1 16
>;;
>run;
>
>since the above person has schedule type 1, their absolute last day to
start
>vacation is 12/30/08 which is 2 days before the end of the year (Tu
12/30/08
>and We 12/31/08)
what about holydays? Are they counted as vacation days or not? Think not...
So you might need a format or something else to track that also.
The formula of Gauss might help you to get the easter and all the other
holydays.
My idea:
For each schedule mark the days which are not to be counted as vacation
days with the help of the holydays and the weekday function. So you might
get a format for each date which tells you that the day is to be counted
or not.
Eg the format $vac could be like:
"1+24dec2008" = "blocked"
"1+23dec2008" = "vac "
...
That format you can build. Then you know, how many vacation days are to be
taken for that year and you can count back.
...
counter=0;
date = "01jan2009"d;
do while (counter<vac_2_take);
date=date-1;
if put(cats(put(sched,1.),"+",put(date,date9.),$vac.)=: "vac" then
counter+1;
end;
call symput("vac_start",put(date,date9.));
...
run;
%put &vac_start;
don't know if that works, but something like that...
Gerhard
|