LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 17 Dec 1997 10:00:12 -0500
Reply-To:     Victor Kamensky <kamensky@AECOM.YU.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Victor Kamensky <kamensky@AECOM.YU.EDU>
Subject:      Re: Way to Sum Duplicates?
Content-Type: text/plain; charset="us-ascii"

Hays! hERE IS THE DATA STEP SOLUTION: PROC SORT DATA=ORACLE_Q; BY STYLE;RUN; DATA ORACLE_Q; SET ORACLE_Q; BY STYLE; RETAIN TOTSALES; IF FIRST.STYLE THEN TOTSALES=0; TOTSALES+STYLE; IF LAST.STYLE; RUN; PROC SOLUTION: PROC MEANS SUM DATA=ORACLE_Q; CLASS STYLE; VAR SALES;RUN; Victor Kamensky Programmer Albert Einstein College of Medicine At 08:42 AM 12/17/97 -0600, you wrote: >I have a dataset that is the outcome of a query to an Oracle database. >It contains numerous observations of styles and sales. There are many >observations for a given style, so total sales for the style would be >the sum of all obs with that style. > >I know this can be done with Proc SQL doing a sum and group by, but is >there an easy way to sum all observations of duplicate keys using SAS >data step commands? Or a Proc? > >--Hays McLean > >


Back to: Top of message | Previous page | Main SAS-L page