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 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 3 Sep 2008 16:03:52 -0400
Reply-To:     "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject:      Re: Removing annoying NOTE!
In-Reply-To:  <200809031953.m83AmWA9030955@malibu.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii

> if last.id then do; > do _i_ = 1 to 3; > *line 3317 tot[_i_] = tot[_i_]/cnt[_i_]; > end;

in general: If Denominator eq . then Result = .; else Result = Numerator/Denominator;

OR

if cnt[_i_] eq . then tot[_i_] = .; else tot[_i_] = tot[_i_]/cnt[_i_];

Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov

> -----Original Message----- > From: owner-sas-l@listserv.uga.edu > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of syk > Sent: Wednesday, September 03, 2008 3:54 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Removing annoying NOTE! > > hi all > Can any one suggest how to remove the annoying NOTE given > below the code? > thanks > > data a; > input id var1 class; > datalines; > 1 6 1 > 1 8 1 > 1 7 2 > 1 5 2 > 1 3 3 > 1 4 3 > 2 3 1 > 2 4 1 > 2 5 3 > 2 8 3 > 3 2 1 > 3 6 1 > 3 8 2 > 3 9 2 > 3 4 3 > ; > run; > > data b (keep= id tot1-tot3 cnt1-cnt3); > do until(last.id); > set a; > by id; > array cnt[*] cnt1-cnt3; > array tot[*] tot1-tot3; > if first.id then do; > do i= 1 to 3; > cnt[i]=0; > tot[i]=0; > end; > end; > _i_ = class; > cnt[_i_] + 1 ; > tot[_i_]=sum(tot[_i_], var1); > > if last.id then do; > do _i_ = 1 to 3; > *line 3317 tot[_i_] = tot[_i_]/cnt[_i_]; > end; > end; > end; > run; > > NOTE: Division by zero detected at line 3317 column 25. > last.id=1 id=2 var1=8 class=3 FIRST.id=0 cnt1=2 cnt2=0 cnt3=2 tot1=3.5 > tot2=. tot3=6.5 i=4 _i_=4 > _ERROR_=1 _N_=2 > NOTE: Mathematical operations could not be performed at the following > places. The results of > the operations have been set to missing values. > Each place is given by: (Number of times) at (Line):(Column). > 1 at 3317:25 > NOTE: There were 15 observations read from the data set WORK.A. > NOTE: The data set WORK.B has 3 observations and 7 variables. > NOTE: DATA statement used (Total process time): > real time 0.01 seconds > cpu time 0.01 seconds > >


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