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;
   proc summary data=&data nway;
      by &by;
      var ∑
      id &id;
      output out=&out (drop=_:) sum=;
%mend proc_sort;

/* This macro mimics the SUM functionality available with PROC SORT on MVS with Syncsort */
%proc_sort (data=sasds1
                   ,by=type gmm cat
                   ,id=gmm_d cat_d