Help using Base SAS procedures

SAS w.d format issue

Reply
N/A
Posts: 1

SAS w.d format issue

I'm just a student and a newbie in SAS and I'm in need of a little help. Any response would be very much appreciated. So here goes my simple code:

data decimal;

input num 7.1; /w.d format/

cards;

1234567

;

proc print;

run;

here are the test cases and outputs:

     w.d format          SAS output

        7.0               1234567

        7.1               123456.7

        7.2               12345.67

        7.3               1234.57

        7.4               123.457

        7.5               12.3457

        7.6               1.23457

        7.7               0.12346

        7.8               0.012346

        7.9               .001234567

        7.10          .000123457

        7.11          .000012346

My question is that, in what way do SAS round off numbers to come up with different outputs? For example, in 7.0-7.2 format, they did not round off anything, in 7.3-3.6, they rounded off 567 to 570, in 7.7-7.8, they rounded off 456 to 460, etc. I'm really having trouble understanding why this happens. I hope you can help me. Thank you very much

Ask a Question
Discussion stats
  • 0 replies
  • 143 views
  • 0 likes
  • 1 in conversation