Ohhhhh thank you so much ! It works very well ! Thank you, I was disappointed not to find the solution ! I made a little transformation of the solution to fit correctly on my datasets. And you were right about the 'restriction', but it's because i simplify the code and so, it seems weird and like there are no restrictions 🙂 So this is the final version (with comment in French sorry 🙂 😞 %global date_debut_ouverture nbmois;
%let date_debut_ouverture = "01sep2013"d;
%let nbmois = 24 ;
/*MACRO pour calculer date_debut_ouverture + i mois*/
data _null_;
do i=1 to &nbmois;
dt=intnx("month",&date_debut_ouverture.,i,'same'); /* date_debut_ouverture + i mois */
dt_bis = put(dt,date9.) ; /* dt sous format 01oct2013*/
ym=substr(put(year(dt),z4.),3)||put(month(dt),z2.); /* ym = 1310 (format 'YYMM') */
call symput(cats('date_table_',i),ym); /* enregistrement dans date_table_i = ym */
call symput(cats('date_',i),dt_bis); /* enregistrement dans date__i = dt */
end;
run;
/*on lit les tables WORK.A_YYMM etc. */
%Macro fonction_table(YYMM);
proc sql ;
create table work.sortie as select *
FROM work.A_&YYMM ; /* lecture de la table : work.A_1310 */
quit ;
%Mend fonction_table;
%fonction_table(&date_table_1);
Thank you again !!! Super answer !!! 🙂 Have a good day RW9 🙂
... View more