As required, I need to report the statistics to two decimal places. Here is part of my code:
"
proc means data=college maxdec=2 noprint;
by gender schoolsize;
format gender $gender. schoolsize $size.;
var classrank GPA;
output out=by_data
mean=mean_classrank mean_GPA
median=median_classrank median_GPA
min=min_classrank min_GPA
max=max_classrank max_GPA
nmiss=nmiss_classrank nmiss_GPA
n=n_classrank n_GPA;
run;
"
Here is the part of the list:
"
Statistics Broken Down by Gender and Schoolsize
m
e n
m d m
e i m m i
a a i a s
n n n x s n
S _ _ m _ _ _ _
c c c e c c c n c
h l m l d l l l m l
o a e a i a m a m a i a
G o _ _ s a s a s i s a s s s
e l T F s n s n s n s x s s s n
n S Y R r _ r _ r _ r _ r _ r _
d i P E a G a G a G a G a G a G
e z E Q n P n P n P n P n P n P
r e _ _ k A k A k A k A k A k A
Female Missing 0 1 60.0000 4.00000 60.0 4.000 60 4.00 60 4 0 0 1 1
Female Large 0 10 70.0000 3.59111 66.5 3.610 49 3.18 91 4 2 1 8 9
Female Medium 0 23 67.9545 3.60810 68.0 3.790 42 2.65 99 4 1 2 22 21
Female Small 0 26 75.9524 3.42400 79.0 3.460 45 2.29 99 4 5 1 21 25
Male Missing 0 3 67.6667 4.00000 72.0 4.000 46 4.00 85 4 0 1 3 2
Male Large 0 8 76.0000 3.63286 73.0 3.740 45 2.98 98 4 1 1 7 7
Male Medium 0 18 71.8125 3.46167 73.0 3.585 43 2.36 100 4 2 0 16 18
Male Small 0 11 71.7000 3.32273 73.5 3.170 41 2.63 93 4 1 0 10 11"
It seems that the MAXDEC did not work here. What's wrong? How can I control the decimal places in this report?
Yes.maxdec only is used for display output, not dataset of output.
You need to format the variables in dataset by yourself. Like:
data class;
set sashelp.class;
format _numeric_ best10.2;
run;
Ksharp
Yes.maxdec only is used for display output, not dataset of output.
You need to format the variables in dataset by yourself. Like:
data class;
set sashelp.class;
format _numeric_ best10.2;
run;
Ksharp
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.