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 (September 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 2 Sep 2005 15:09:28 -0700
Reply-To:     David L Cassell <davidlcassell@MSN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         David L Cassell <davidlcassell@MSN.COM>
Subject:      Re: sequential summing/ sequential running totals of column values
In-Reply-To:  <200509021649.j82F6l9n025130@malibu.cc.uga.edu>
Content-Type: text/plain; format=flowed

wilsonjaredm@GMAIL.COM wrote: >I wonder if anyone could help? I'm trying to sum values in one column=20 >sequentially, producing the running total of each column in a seperate=20 >column. So in the example below column 'a' contains the original data and= >=20 >column 'as' contains the corresponding running total when each value is=20 >summed sequentially, greatest value first. I've searched the web plus past= >=20 >listings on this listserve and can't find what I'm looking for. Not sure >if= >=20 >I have to use proc sort on each column in turn (I have 100 such columns) >an= >d=20 >use Suma+a in a data step, or whether there is a function that will do >what= >=20 >i want without having to sort first.=20 >I wonder if anyone could help? I'm trying to sum values in one column=20 >sequentially, producing the running total of each column in a seperate=20 >column. So in the example below column 'a' contains the original data and= >=20 >column 'as' contains the corresponding running total when each value is=20 >summed sequentially, greatest value first. I've searched the web plus past= >=20 >listings on this listserve and can't find what I'm looking for. Not sure >if= >=20 >I have to use proc sort on each column in turn (I have 100 such columns) >an= >d=20 >use Suma+a in a data step, or whether there is a function that will do >what= >=20 >i want without having to sort first.=20 >Many thanks for any help! >jared > a as b bs c cs 4 4 10 100 2 96 2 9 30 70 74 74 1 10 40 40 20 94 3 7 >20= >=20 >90 1 97

I don't see what you're after.

Are you saying that you want each variable {a, b, ...} sorted separately in descending order and then summed in the matching variable? If so, then how do oyu plan to hold the data? The data structure itself seems to be working against you. If you get A sorted and then summed in AS, then what happens when you sum up B? Everything in A and in AS is now hosed. For that matter, I don't see the point of the sums either.

Do you need to build your data structure differently, so that the sum variables AS, BS, etc. are in a separate data set?

If all you want is sequential sums, that would be easier. But I cannot tell, since your 'example data' are unreadable. How about writing back to the list with a simple example of, say, 5 variables and 10 rows? Show us the original data, and what you want the final product to look like. Try to include all the cases that would matter, including what to do when there are ties.

I also think it would *really* help if you wrote back to the list and explained why you are trying to get this.

David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330

_________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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