BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASdevAnneMarie
Rhodochrosite | Level 12

Hello Experts,

 

I'm wondering why the mean is not equal to 0 ?

Capture d’écran 2026-03-06 213415.png

My code is : 

proc standard data=sashelp.cars mean=0 std=1 out=bdd;
var _numeric_;
run;

proc means data=bdd;
	var _numeric_;
run;

Thank you for your help !

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you want PROC MEANS to only display a fixed number of decimal places use the MAXDEC= option.

proc standard data=sashelp.cars mean=0 std=1 out=bdd;
run;

proc means maxdec=4;
run;

image.png

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

This is roundoff error. It happens when digital computers do math on numbers that are not integers and not 2 to the power of any negative integer. For any real-world purpose, you can treat these as exactly zero.

 

If you look in data set BDD, you can see for example, that cylinders (which is an integer in SASDATA.CARS) is not an integer and not 2 to the power of any negative integer.

 

 

Screenshot 2026-03-06 162829.png

--
Paige Miller
Tom
Super User Tom
Super User

If you want PROC MEANS to only display a fixed number of decimal places use the MAXDEC= option.

proc standard data=sashelp.cars mean=0 std=1 out=bdd;
run;

proc means maxdec=4;
run;

image.png

SASdevAnneMarie
Rhodochrosite | Level 12
Thank you, Tom!
Is there an option to hide the minus sign?
PaigeMiller
Diamond | Level 26

Why does removing the minus sign make the slightest bit of difference? Why would you do that? What is the benefit?

--
Paige Miller

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 938 views
  • 2 likes
  • 3 in conversation