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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
| %macro jourFerie;
options dflang = "french" ;
%let debut=YEAR(Today())-1;
%let fin=YEAR(Today());
data CHEZMOI.JoursFeries (keep=date descr );
attrib date length=5. format=ddmmyy10. ;
attrib Descr length=$20. ;
do year=&debut to &fin ;
/* Jours fériés fixes */
Date=mdy (1, 1, year) ; Descr="Jour de l'an" ; output ;
Date=mdy (5, 1, year) ; Descr="Fête du travail" ; output ;
Date=mdy (5, 8, year) ; Descr="Fête de la Victoire 1945" ; output ;
Date=mdy (7, 14, year) ; Descr="Fête nationale" ; output ;
Date=mdy (8, 15, year) ; Descr="Assomption" ; output ;
Date=mdy (11, 1, year) ; Descr="Toussaint" ; output ;
Date=mdy (11, 11, year) ; Descr="Armistice de 1918" ; output ;
Date=mdy (12, 25, year) ; Descr="Noël" ; output ;
/* Pâques */
c=int(year/100);
n=year-(19*int(year/19));
k=int((c-17)/25);
i=c-int(c/4)-int((c-k)/3)+(19*n)+15;
i=i-(30*int(i/30));
i=i-(int(i/28)*(1-int(i/28)*int(29/(i+1))*int((21-n)/11)));
j=year+int(year/4)+i+2-c+int(c/4);
j=j-(7*int(j/7));
month=3+int((i-j+40)/44);
day=i-j+28-(31*int(month/4));
date=mdy(month,day,year); Descr="Dimanche de Pâques" ; output ;
date +1; Descr="Lundi de Pâques" ; output ;
/* Ascension 40 jours après Pâques */
date +38 ; Descr="Ascension" ; output ;
/* Pentecôte 11 jours après l'ascension */
date +10 ; Descr="Pentecôte" ; output ;
date +1 ; Descr="Lundi de Pentecôte" ; output ;
end;
run;
/*Compter nombre de lignes*/
proc sql noprint;
select count(*) into :nbligne from CHEZMOI.JOURSFERIES;
quit;
/*Compter nombre de lignes*/
proc sql noprint;
select count(*) into :nbligneECO from CHEZMOI.2015_C;
quit;
/*Récupération des jours fériés */
data _NULL_;
set CHEZMOI.JOURSFERIES;
CALL SYMPUT(COMPRESS("date"||_N_),date);
run;
/*Récupération des jours DDE*/
data _NULL_;
set CHEZMOI.ECO_2015_TESTBIS2;
CALL SYMPUT(COMPRESS("dateDDE"||_N_),DATE_DDE);
run;
/*Récupération des jours EXPEDITION*/
data _NULL_;
set CHEZMOI.ECO_2015_TESTBIS2;
CALL SYMPUT(COMPRESS("dateEXP"||_N_),DATE_EXP);
run;
Data CHEZMOI.ColonneFerie;
Set CHEZMOI.2015_C;
Ferie = 0;
RUN;
%do i = 1 %to &nbligneECO;
%do j = 1 %to &nbligne;
Data CHEZMOI.JrFerie;
Set CHEZMOI.ColonneFerie;
%If _N_ = i %then %do;
%If &&dateEXP&i = " " OR &&dateDDE&i = " " %THEN %do;
Ferie = 0;
%end;
%Else %do;
%If (&&dateEXP&i - &&dateDDE&i)>(&&dateEXP&i - &&date&j) %then %do;
Ferie = 1;
%end;
%Else %do;
Ferie = 0;
%End;
%End;
%End;
Run;
%end;
%end;
%mend;
%jourFerie; |
Partager