Hi guys, I'm not that good at macro, still learning and haven't found the solution to my problem. I have created two variables VarName and VarDate data have; input VarName $ VarDate :ddmmyy10.; format VarDate ddmmyy10.; datalines; A_10 14/06/2020 A_11 12/06/2020 B_10 30/06/2020 B_11 30/06/2020 C_10 31/05/2020 C_11 29/05/2020 D_10 30/04/2020 D_11 30/04/2020 E_10 31/03/2020 E_11 31/03/2020 F_10 29/02/2020 F_11 28/02/2020 G_10 31/12/2021 G_11 31/12/2021 ; run; Put the values of VarName to a macro variables(thanks to @ed_sas_member :)) data _null_; set have; call symputx(VarName, put(VarDate,ddmmyy10.)); run; Then I Run a macro which modifies dates with the parameter=ddata: %macro newDates(ddata);
%global &ddata._txt &ddata._dash; data _null_;
set have;
call symput("&ddata._TXT", "'"!!compress(put(&ddata.,yymmdd10.),'-')!!"'");
call symput("&ddata._DASH", "'"!!put(&ddata.,yymmdd10.)!!"'");
run;
%put ********** &dato._TXT: &&&dato._TXT;
%put ********** &dato._DASH: &&&dato._DASH;
%mend; And here comes my problem: Instead of naming all parameters separately, is it possible to pass a list of parameters to my %macro newDates? Instead of writing this(in my real program I have near hundred of parameters to write): %newDates(A_10) %newDates(A_11) %newDates(B_10) %newDates(B_11) %newDates(C_10) %newDates(C_11) and so on...... I am dreaming to call a macro %newDates once with list of needed parameters: %newDates(param_list) where param_list would be all the parameters from data have column VarName The results of running the %newDates(param_list) in the log should be like this: ********** A_10_TXT: '20200614' ********** A_10_DASH: '2020-06-14' ********** A_11_TXT: '20200612' ********** A_11_DASH: '2020-06-12' ********** B_10_TXT: '20200630' ********** B_10_DASH: '2020-06-30' ********** B_11_TXT: '20200630' ********** B_11_DASH: '2020-06-30' and so on for every VarName.... If someone could help me, it would be incredible 🙂
... View more