Return to Snippet

Revision: 6175
at May 3, 2008 15:19 by webonomic


Initial Code
/*Taken from thread http://groups.google.com/group/comp.soft-sys.sas/browse_thread/thread/8cdec58cd0846e29?hl=en*/

/*Method 1*/
proc sql feedback;
   *describe table dictionary.columns;
   select
      catx(' ','Sum(',name,') as',
               Name,ifc(not missing(format),cats('format=',format),' '))
      into :sumlist separated by ', '
      from dictionary.columns
      where libname eq 'SASHELP' and memname eq 'SHOES' and type eqt 'n'
      ;
   %put NOTE: &numlist;
   select region, product, &sumlist
      from sashelp.shoes
      group by region, product
      ;
   quit;
   run; 


/*Method 2*/
proc sql;
  select region, product, sum(stores) as sumstores, sum(sales) as sumsales,
  sum(inventory) as suminventory, sum(returns) as
  sumreturns from sashelp.shoes
  group by region, product;
quit;

Initial URL
http://jaredprins.squarespace.com/blog/2008/5/11/use-proc-sql-to-summarize-tables-into-groupings.html

Initial Description
Using Proc SQL summarize the table sashelp.shoes grouping on

Initial Title
Using Proc SQL to summarize tables into groupings

Initial Tags
sql

Initial Language
SAS