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 (August 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 20 Aug 2007 19:40:21 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: Subtracting 2 variables
Comments: To: tanwanzang@YAHOO.COM
In-Reply-To:  <1187638376.158603.13580@m37g2000prh.googlegroups.com>
Content-Type: text/plain; format=flowed

RightDiff = Sum( A , -B , 0 ) ;

Toby Dunn

Two wrongs are only the beginning.

Success always occurs in private and failure in full view.

Experience is something you don't get until just after you need it.

From: tanwan <tanwanzang@YAHOO.COM> Reply-To: tanwan <tanwanzang@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Subtracting 2 variables Date: Mon, 20 Aug 2007 12:32:56 -0700

When adding, using '+' may produce wrong results (if some obs are missing), so one may use the SUM function. Is there a fuction equivalent to SUM for subtracting, that can handle missing data? As in:

data; input a b; wrong_sum = a+b; right_sum=sum(a, b); wrong_diff=a-b; cards; 1 2 .. 9 7 . ;proc print; run;

I would like to have the right_diff as -1, -9 and 7

_________________________________________________________________ Tease your brain--play Clink! Win cool prizes! http://club.live.com/clink.aspx?icid=clink_hotmailtextlink2


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