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 !!! 😄
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.