I have a "MOD" period that goes from OCt/2019 to Dec/2019 and another "OOT" period that goes from Jan/2020 to MAR/2020.
How do I call these values only once? Because in the code I have, I need to declare it in "LET" and at the end of the macro another six times.
%let dt1_mod_start = 201910;
%let dt2_mod_end = 201912;
%let dt1_oot_start = 202001;
%let dt2_oot_end= 202003;
%MACRO PSI (dt);
data dtbase1;
set dtbase;
if &dt1_mod_start. <= put(dta,yymmn6.) <= &dt2_mod_end. then period = "MOD";
else if &dt1_oot_start. <= put(dta,yymmn6.) <= &dt2_oot_end. then period = "OOT";
else period = "OTHER";
run;
proc sql;
create table perf_&dt. as select
dta format yymmn6. as date,
period,
leaf,
in_default,
count(*) as total
from dtbase1
where put(dta,yymmn6.) in ("&dt.")
group by date,period,leaf,in_defaul;
quit;
%mend;
%PSI (201910);
%PSI (201911);
%PSI (201912);
%PSI (202001);
%PSI (202002);
%PSI (202003);
... View more