I would like to be able to explain the differences in the default rounding between different procedures. For example, consider the following data set where we have three exam grades from 10 students, and I want to calculate the average grade for each exam. This has been computed by both proc means and proc sql. DATA grades;
INPUT name $ exam1 exam2 exam3;
DATALINES;
Shannon 96 82 83
Lex 92 81 68
Becky 92 75 73
Lora 94 65 70
Susan 91 77 85
Hunter 76 72 86
Ulric 98 71 80
Richann 90 60 60
Tim 97 94 100
Ronald . 77 60
;
RUN;
PROC MEANS DATA=grades;
VAR exam1 exam2 exam3;
RUN;
PROC SQL;
SELECT COUNT(exam1) AS n_exam1,
MEAN(exam1) AS ave_exam1,
COUNT(exam2) AS n_exam2,
MEAN(exam2) AS ave_exam2,
COUNT(exam3) AS n_exam3,
MEAN(exam3) AS ave_exam3
FROM grades;
QUIT; When you use proc means, the output by default consistently rounds to seven decimal places. However, when you use proc sql the output rounds to something that I guess is more related to significant digits or precision. Could some one explain the default rounding more formally, especially for proc sql?
... View more