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 (February 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 14 Feb 1997 21:24:04 +0100
Reply-To:     ehoogenb@solair1.inter.nl.net
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Eric Hoogenboom <ehoogenb@SOLAIR1.INTER.NL.NET>
Organization: NLnet
Subject:      Re: SAS calculations
Content-Type: text/plain; charset=us-ascii

Sheridan Young wrote: > > I have a numeric variable column and I want to sum the column and then > add another variable which calculates the percentage of the total (sum) > from the first variable column. > Example: > > var 1 Percnt > 3 18.7% > 3 18.7% > 3 18.7% > 3 18.7% > 4 25.0% > - > 16 > > Thank you > > Sheridan Young

Try using proc sql.

Assuming your dataset is called "raw"

proc sql; select raw.var1, put(raw.var1/aggr.sumvar1) as pcvar1 from raw, (select sum(var1) as sumvar1 from raw) aggr; run; quit;

I haven't tested it, but it should do the trick.

Eric.


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