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"
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;
PROC MEANS SUM DATA=ORACLE_Q; CLASS STYLE; VAR SALES;RUN;
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?