Date: Mon, 10 Jun 1996 12:30:20 -0400
Reply-To: AdamHndrx <adamhndrx@aol.com>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: AdamHndrx <adamhndrx@AOL.COM>
Organization: America Online, Inc. (1-800-827-6364)
Subject: Re: # of weekdays between two SAS dates
>A colleague of mine wonders if there is code out there to calculate the
>number of weekdays between two SAS dates. For his purposes, weekdays are
>all days Mon-Fri. In other words, the # of weekdays between two dates
>would be the number of days, minus all Saturdays & Sundays.
>Thanks,
>Greg Diment
Here is a simple program that takes advantage of the WEEKDAY format to
count weekdays between to dates inclusively:
1 data _null_;
2 date1 = '01jun96'd;
3 date2 = '10jun96'd;
4 do i = date1 to date2;
5 if put(i,weekday.) not in('1','7')
6 then weekdays + 1;
7 end;
8 put weekdays=;
9 run;
WEEKDAYS=6
Adam Hendricks
ICOS Corporation
Bothell, WA, USA
|