BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bc2017
Calcite | Level 5

proc means for 5 variables with outlier.PNG

 

I'm aware when using the PROC Means procedure that you can round the entries in the resulting table to a certain number of decimal places but is there a way to round them to a certain number of significant figures. If there isn't, is there another procedure for generating summary statistics where this could be specified?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13
proc means data=sashelp.heart stackodsoutput;
   ods output summary=s;
run;
proc print label noobs;  format _numeric_ bestd8.7; run;

Look at the D and BestD formats.  This would be the easiest way to use them with PROC MEANS I think.

 

https://blogs.sas.com/content/sgf/2017/05/30/the-best-d-formats-that-you-have-ever-seen/

View solution in original post

3 REPLIES 3
Reeza
Super User

You can either output the data to a data set (see Examples 2 & 10 in the Documentation) or you could use PROC TABULATE for the same decimal places. However, significant digits are different and that's usually not a fixed rule, if I recall correctly.  So it may be easier to output to a data set and then implement your display rules and then use PROC PRINT or REPORT to display the output. 

WarrenKuhfeld
Ammonite | Level 13
proc means data=sashelp.heart stackodsoutput;
   ods output summary=s;
run;
proc print label noobs;  format _numeric_ bestd8.7; run;

Look at the D and BestD formats.  This would be the easiest way to use them with PROC MEANS I think.

 

https://blogs.sas.com/content/sgf/2017/05/30/the-best-d-formats-that-you-have-ever-seen/

PGStats
Opal | Level 21

You could do it with the ODS:

 

proc means data=sashelp.class n mean std median clm STACKODSOUTPUT;
format age height weight best4.;
label weight="Weight (pounds)";
var age height weight;
ods output Summary=s;
run;

Proc sql;
select 
    variable,
    label,
    n,
    mean format=best5.,
    stdDev format=best6.,
    median format=best5.,
    lclm format=best5.,
    uclm format=best5.
from s;
quit;
PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 3617 views
  • 3 likes
  • 4 in conversation