www.sas.com > SAS UK > In the Know Homepage Search | Contact Us     
SAS UK Newsletter Banner SAS - The power to know(tm)  

How Can I Work Out When Easter Sunday Falls in Any Given Year?

The following code is used to calculate when Easter Sunday falls in any given year. This is especially handy in the Financial Services areas where certain jobs/processes are required not to be run on bank holidays.

 
%macro calculate_easter(year);
	%global easter;
	data _null_;
		a = mod(&year.,19);
 		b = floor(&year./100);
 		c = mod(&year.,100);
		d = floor(b/4);
		e = mod(b,4);
		f = floor((b+8)/25);
		g = floor((b-f+1)/3);
		h = mod(((19*a) + b - d - g + 15),30);
		i = floor(c/4);
		k = mod(c,4);
		l = mod((32 + (2*e) + (2*i) - h - k),7);
		m = floor((a + (11*h) + (22*l))/451); 
		n = floor((h + l - (7*m) + 114)/31);
		o = mod ((h + l - (7*m) + 114),31);
		easter = put(mdy(n,(o + 1),&year.),ddmmyy10.);
		call symput("easter",easter);
	run;

%mend calculate_easter;
%calculate_easter(year=2006);
%put ⩮