Hello,
First of all, excuse my english, i'm a french student !
I find many things on internet but i have a little problem. I want to execute a macro programm many times with differents parameters.
This is the code i make with the help of internet and of another subject : https://communities.sas.com/t5/SAS-Programming/how-to-make-a-do-loop-for-running-the-same-code-multi...
%macro run_macro (typequest =,nom_fichier_csv=);
%DO i = 1 %to %sysfunc(countw(&typequest));
%let nextvar = %scan(&typequest, &i);
%let nextchemin = %scan(&nom_fichier_csv, &i);
%cim_eer_ev (typequest = &nextvar
,chemin_fichier = &nextchemin
,jour_fin_trim_precedent = &mois_fin_trim_precedent
,mois_fin_trim_precedent = &jour_fin_trim_precedent
,annee_fin_trim_precedent = &annee_fin_trim_precedent )
%END ;
%mend run_macro ;
%run_macro(typequest = cim eer
,nom_fichier_csv= cim_all eer_all
);It's run well for the first parameters : cim and cim all, but it doesn't loop on the second part (eer and eer_all)...
Someone have an idea ?
Thank you and really sorry for my english !!
Hello,
You don't show the code for macro cim_eer_ev. I suspect that this macro also uses a macrovariable counter &i that overrides the one you use in run_macro. To avoid this type of problem, you have to declare i as %local in each macro.
Hello,
You don't show the code for macro cim_eer_ev. I suspect that this macro also uses a macrovariable counter &i that overrides the one you use in run_macro. To avoid this type of problem, you have to declare i as %local in each macro.
Thank you very much, it is working perfectly !!! 😄
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.