1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
* Here is a way to compute elapsed weekdays excluding Public Holidays *.
* Raynald Levesque Summer 2002.


data list / date1 1-10 (ADATE) date2 12-21 (ADATE) .
begin data
1/12/2001 03/01/2002
01/20/1998 02/28/1998
02/12/1998 02/18/1998
end data.

* Just a baseline normal number of days* .
COMPUTE DAYS =CTIME.DAYS(date2-date1).

*Note dates are stored in seconds, 86400 per day * .
COMPUTE WKDAYS=0.
LOOP #=date1 to date2 BY 86400.
* You have to add all applicable public holidays in next ANY command below.
If RANGE(XDATE.WKDAY(#),2,6) & ~ANY(#,
	DATE.DMY(1,1,2002),
	DATE.DMY(1,1,2001),
	DATE.DMY(25,12,2001)
	)
	WKDAYS=WKDAYS +1.
END LOOP.

list.