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 (March 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Mar 2009 09:25:11 -0500
Reply-To:     Kevin Viel <citam.sasl@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Kevin Viel <citam.sasl@GMAIL.COM>
Subject:      Re: Column Sum

On Wed, 4 Mar 2009 19:47:00 -0800, sasnt4me@GMAIL.COM wrote:

>I want to calculate column sum of a varibale and should note it next >to the variable > >Data have > >id name age count >1 aaa 3 4 >2 bbb 4 2 >3 ccc 3 5 > > >table want >id name age count count_sum >1 aaa 3 4 11 >2 bbb 4 2 >3 ccc 3 5

How many different approaches do you want? :)

Is count_sum supposed to be missing for the other observations? If not, an introduction to SQL will be useful:

proc sql ; create table want as select * , sum( count ) as count_sum from have /* group by name */ ; quit ;

Notice I have commented out the GROUP BY part...very powerful.

What is the purpose of adding this datum to your dataset? Perhaps we can offer better solutions...

HTH,

Kevin

>How to accomplish this?


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