Contributor
Posts: 59

# Convert -0 to 0

data test;
if total = -0 then R=0;

run;

This did not convert -0 to 0;

I tried this also

data test;

if total = 0 then R = abs(val0);

run;

Posts: 3,000

## Re: Convert -0 to 0

Do you really have values that are –0?? I have never seen them. Why bother converting them, anyway?

But your code is off the mark.

data test;

set test;

if total= -0 then total=0;

run;

--
Paige Miller
Posts: 3,852

## Re: Convert -0 to 0

```Paige Miller wrote:

Do you really have values that are –0?? I have never seen them. Why bother converting them, anyway?

But your code is off the mark.

data test;
set test;
if total= -0 then total=0;
run;
```

It's has to do with w.d format.  I don't know if it is intentional or not but very small negative print as -0.

17         data _null_;
18            do x = -3e-16, round(x,1e-15);;
19               put 'NOTE: ' x= x=10.1 x=10.2 x=10.3;
20               end;
21            run;

NOTE:
x=-3E-16 x=-0.0 x=-0.00 x=-0.000
NOTE: x=
0 x=0.0 x=0.00 x=0.000
Super User
Posts: 23,700