DATA Step, Macro, Functions and more

division by ZERO

Reply
N/A
Posts: 0

division by ZERO

hi,
i used the new IFC function to avoid division by 0, but it seems it does not work:
data test;
input a b ;
l=ifn(b=0 , 0 , a/B ) ;
cards;
10 2
10 5
8 0
8 4
;
run;

reason ????
N/A
Posts: 0

Re: division by ZERO

i mean IFN function of course
SAS Super FREQ
Posts: 8,744

Re: division by ZERO

Hi:
Also, using the DIVIDE function
http://support.sas.com/kb/19/965.html

does not produce the "divide by zero" message that you get when you code your division this way divide(a,b) versus a/b

cynthia
Contributor
Posts: 43

Re: division by ZERO

Not like IF/THEN/ELSE, IFN calculate 'a/b' in advance, then judge the logical statement 'b=0'. Smiley Happy
Ask a Question
Discussion stats
  • 3 replies
  • 182 views
  • 2 likes
  • 3 in conversation