control the number of decimal places in SAS proc means

EbrahimA picture EbrahimA · Feb 1, 2015 · Viewed 7.5k times · Source

I am trying to report my proc means output with 10 decimal places by specifying maxdec=10. However, SAS does not report more than 7 decimal places. Here is the warning I get: WARNING: NDec value is inappropriate, BEST format will be used. I appreciate any suggestion.

Answer

DomPazz picture DomPazz · Feb 1, 2015

If you look at the documentation, it states that MEANS will print out 0-8 decimal places based on the value of MAXDEC. If you want more, you will need to save the results and print them yourself.

Try this:

data test;
format x 12.11;
do i=1 to 1000;
   x = rannor(0);
   output;
end;
drop i;
run;

proc means data=test noprint;
var x;
output out=means_out mean=mean std=std;
run;

proc print data=means_out noobs;
var mean std;
format mean std 12.11;
run;