Hi, i need to output only the particular dates from current to the past 16 years. I have one code, which lists all the quarters..i need to modify that in such a way it should return only the current quarter in each of the past hears. Ex: If current quaretr = 2020Q2, it should return (2020Q2,2019Q2,2018Q2........) in a specific format int he ouput. The code is as below: %let REPORTING_PERIOD_YYYYMMDD =20200630;
%let year_count = 16;
%put &year_count;
%let val_date_current = %sysfunc(dhms(%sysfunc(inputn(&reporting_period_yyyymmdd., yymmdd8)),0, 0, 0));
%put &val_date_current;
%let val_date_first = %sysfunc(dhms(%sysfunc(intnx(year, %sysfunc(datepart(&val_date_current.)),-&year_count., end)), 0,0, 0));
%put &val_date_first;
%let val_date_count = %eval(%sysfunc(intck(dtquarter, &val_date_first., &val_date_current.)) + 1);
%put &val_date_count;
data Final;
do val_date_count=1 to &val_date_count.;
val_date = intnx('quarter', datepart(&val_date_first.), val_date_count-1, 'end');
arr_VAL_DATE = strip(put(val_date, ddmmyy10.));
output;
end;
run; Thanks, Chithra
... View more