—•Today is •—

Two examples of using different procedures to total the amount paid by MEMBERID; the PROC MEANS (with output data set) and PROC TABULATE. You may want to choose that best suits to your reporting needs.


data one; 
input MEMBERID $ 1 - 10   LOB $ 11 - 12 THRUDATE 13 - 20 PAID; 
cards ; 
100XX00001HM20070101 300.00 
100XX00001HM20070101 299.15 
100XX00001HM20070103 302.50 
200XX00002MR20070101 150.00 
200XX00002MR20070110  75.00 
300XX00003PS20070103 100.00 
300XX00003PS20070103 185.00 
300XX00003PS20070104 150.00 
400XX00004HM20070101 135.00 
; 
run;
 
/*using proc means*/ 
proc means data =one maxdec = 2 sum ; 
  class memberid lob thrudate; 
  var paid; 
  output out =results(drop=_type_) 
         sum = / autoname ; 
/*create output data set*/ 
run ; 
  
data results; 
  set results; 
    if missing(memberid) or missing(lob) or missing(thrudate) 
        then delete ; 
run ; 
  
/*proc tabulate method*/ 
proc tabulate data =one; 
  class memberid lob thrudate; 
  var paid; 
  tables memberid all, paid*sum*f= dollar10.2 ; 
  keylabel sum= ' ' all= 'Total' ; 
  label paid= 'Total Paid' ; 
run ; 
				

Print Document

Copyright © 2007 www.nycinformatics®.com All Rights Reserved
Last edited on: October 26, 2007
SAS product or service names are registered trademarks of SAS Institute, Inc. in the USA and other countries.
® indicates USA registration.
Source: SAS®