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 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 12 Mar 2010 22:00:51 -0400
Reply-To:     Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Muthia Kachirayan <muthia.kachirayan@GMAIL.COM>
Subject:      Re: Sum across variables when there are missing values
In-Reply-To:  <225238.84755.qm@web52107.mail.re2.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1

Use SUM() function instead.

score = sum(score, item1, item2, item3);

On Fri, Mar 12, 2010 at 9:42 PM, Neil Fernando <neilfrnnd@yahoo.com> wrote:

> Dear Colleagues, > > I have a query as to how the sum of item 1, item2 and item3 could be > obtained across rows when there are missing values > (in SAS). > > data food1; > input item1 item2 item3; > cards; > 0 . 1 > . . 1 > 0 0 . > 1 . 1 > ; > run; > > > DATA food2; > SET food1; > score = item1 + item2 + item3; > > RUN; > > > My query: I created a new variable named 'score' in food2 dataset. But it > does not give the sum of item1, item2 and item3, instead it gives a period > (.) because of missing values. > > I would appreciate if you could let me know how to get the sum across rows. > > Thank you for your time. > > > Neil Fernando > > E-mail : neilfrnnd@yahoo.com >


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