Hello,
the following comparison is always false within the %Tmt macro program :
[pre]%If &stMois eq &MyMois and &stAnnee eq &MyAnnee and &stPeriode eq &MyPeriode and %eval(&lFicOk) eq 1 %Then %Do;[/pre]
Though I see 2 records in the listeFichiers table for which the clause should be true.
If someone has an idea it would be great !
phil
[pre]%Macro CopieTable(MyTableSource, MyTableDest);
data &MyTableDest;
set &MyTableSource;
run;
%Mend;
%Global stFichierSource;
%Global stRep;
%Global stPrefD;
%Global stMois;
%Global stAnnee;
%Global stPeriode;
%Global lFicOk;
%Macro Tmt(MyMois,MyAnnee,MyPeriode,MyTableDest);
Proc Sql;
Create table listeFichiers as select distinct Fichier, Mois, Annee, Periode, FicOk, NBENREG
From AppliCft.Ficrecusdet;
Quit;
data _null_;
set listeFichiers;
PrefD="D_";
PrefC="C_";
Post="A_TRAITER\";
RepIn="C:\FichiersAImporter\";
IF Periode='A' then Rep=catx('\',RepIn,Annee,Mois,'ANNUEL',Post);
IF Periode='M' then Rep=catx('\',RepIn,Annee,Mois,'MENSUEL',Post);
Call SymputX('stMois',Mois);
Call SymputX('stAnnee',Annee);
Call SymputX('stPeriode',Periode);
Call SymputX('lFicOk',FicOk);
%put &stMois &MyMois;
%put &stAnnee &MyAnnee;
%put &stPeriode &MyPeriode;
%put &lFicOk;
%If &stMois eq &MyMois and &stAnnee eq &MyAnnee and &stPeriode eq &MyPeriode and &lFicOk eq 1 %Then %Do;
Call SymputX('stPrefD',PrefD);
Call SymputX('stRep',Rep);
libname L "&stRep";
Call SymputX('stFichierSource',Fichier);
/* Si &MyTableDest existe déjà */
%if %sysfunc(exist(&MyTableDest)) eq 1 %then %CopieTable(L.&stPrefD&stFichierSource &MyTableDest,&MyTableDest);
/* Sinon */
/* Si &MyTableDest existe déjà */
%if %sysfunc(exist(&MyTableDest)) eq 0 %then %CopieTable(L.&stPrefD&stFichierSource,&MyTableDest);
%End;
run;
%Mend;
/* Début du traitement */
%Tmt(12,2009,A,AppliCft.Agreg122009a);
[/pre]