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
|
%macro traite_fichier(bibli=, date1=, auj=);
data liste;
set tempo; /*table deja existante rescensant la liste des fichiers*/
if fichier_origin1='' then delete;
run;
data aaa ;
set liste; /*création de la macro_variable "nom_fi" pour traiter chaque fichier individuellement*/
n=_n_;
run;
proc sql noprint;
select max(n) into : max
from aaa;
quit;
%do i=1 %to &max.;
proc sql noprint;
select fichier_origin1 into : nom_fi&i.
from aaa
where n=&i.;
quit;
%let a=&&nom_fi&i;
/*Commencer le traitement pour chaque fichier*/
%put &a.;
%if %sysfunc(exist(&bibli..&a._&date1._l)) %then %do;
%if %index(&a.,AUT)^=0 %then %do;
data bla_&i.;
set &bibli..&a._&date1._l(keep=AA26 AA23 AA40 AA55);
length ED_CODE $200.;
ED_CODE=&a.;
montant_emis=AA26;
if (AA23^=.) and (AA23>&auj.) then
mat_res = (AA23-&auj.);
else mat_res=.;
taux_int=AA40;
type_client=AA55;
keep ED_CODE montant_emis mat_res taux_int type_client;
run;
%end;
%end;
%else %do;
data noexist_&i.;
no_fichier=&a. /*&&nom_fi&i*/;
run;
%end;
%end;
%mend;
%traite_fichier(bibli=Edwin, date1=1505, auj=mdy(07,22,2015)); |
Partager