Sort a SAS dataset and Sum variables at the same time
%macro proc_sort (data=, out=, by=, id=, sum=);
proc sort data=&data;
by &by;
run;
proc summary data=&data nway;
by &by;
var ∑
id &id;
output out=&out (drop=_:) sum=;
run;
%mend proc_sort;
/* This macro mimics the SUM functionality available with PROC SORT on MVS with Syncsort */
%proc_sort (data=sasds1
,out=sasds2
,by=type gmm cat
,id=gmm_d cat_d
,sum=item:);