Hi , Patrick and PGStat.
I figure out another Hash solution without pre-sorting dataset .I think it will be faster than your SQL.
Just Guess.
proc import datafile='d:\software\SampleFile.xls' out=have dbms=excel replace;
getnames=yes;run;
data have(drop=_f);
set have(rename=(filldat=_f));
filldat=input(_f,mmddyy10.);
format filldat mmddyy10.;
run;
proc sql noprint;
select quote(name) into : list separated by ','
from dictionary.columns
where libname='WORK' and memname='HAVE';
quit;
data _null_;
if _n_ eq 1 then do;
declare hash ha1();
declare hiter hi1('ha1');
declare hash ha2();
ha1.definekey('_year','_qtr');
ha1.definedata('_year','_qtr','ha2');
ha1.definedone();
end;
set have end=last;
_year=year(filldat);_qtr=qtr(filldat);
if ha1.find()=0 then ha2.add();
else do;
ha2=_new_ hash(multidata:'Y');
ha2.definekey('_year','_qtr');
ha2.definedata(&list);
ha2.definedone();
ha2.add();
ha1.add();
end;
if last then do;
do while(hi1.next()=0);
ha2.output(dataset: cats('Q',_qtr,'_',_year));
end;
end;
run;
Ksharp