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

How can I set the number of decimal places for outputted means in PROC UNIVARIATE?

I can find the option for decimal places for percentiles, but not means.

PROC UNIVARIATE DATA=Data_02_long NORMAL;
    CLASS time group;
    
    VAR 
   	Efflux;
    
    HISTOGRAM;
    OUTPUT OUT=data_01_output mean=Efflux std=Efflux;
RUN;


PROC PRINT DATA=data_01_output;
RUN;

Screen Shot 2021-11-19 at 8.57.55 AM.png

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

When you do a PROC PRINT, you can control the decimal places there with a format statement. For example:

 

format efflux 8.2;
--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

When you do a PROC PRINT, you can control the decimal places there with a format statement. For example:

 

format efflux 8.2;
--
Paige Miller
_maldini_
Barite | Level 11

Whoops, I may have jumped the gun in accepting this as the solution. Sorry, I want to plot these means using PROC SGPLOT so I need the control the decimal places in the OUTPUT or in the PROC SGPLOT.

PROC SGPLOT data=data_01_output;
	series x=time y=Efflux / lineattrs=(thickness=3px) group=group
		markers markerattrs=(size=10pt) DATALABEL DATALABELATTRS=(Color=grey Family="Arial" Size=12
        Style=Italic Weight=Bold);

	yaxis
	 values=(8 to 12 BY 1) label='Efflux (Mean)'
	 labelattrs=(size=12pt weight=bold color=gray33)
	 valueattrs=(size=12pt weight=bold color=gray33)
	 offsetmin=0 offsetmax=0 grid minor minorcount=1;
	 
	xaxis
	 values=(1 to 3 BY 1) label='Timepoint'
	 labelattrs=(size=12pt weight=bold color=gray33)
	 valueattrs=(size=12pt weight=bold color=gray33)
	 offsetmin=0 offsetmax=0 grid minor minorcount=1;
	
/* 	FORMAT timepoint_graph timepoint_graph_.; */
	
	TITLE "Change in Efflux Over Time (Mean)";
/* 	TITLE2 "PROMIS Pain Intensity Score"; */
	footnote "Footnote: CONFIDENTIAL";
RUN;
PaigeMiller
Diamond | Level 26

@_maldini_ wrote:

Whoops, I may have jumped the gun in accepting this as the solution. Sorry, I want to plot these means using PROC SGPLOT so I need the control the decimal places in the OUTPUT or in the PROC SGPLOT.

PROC SGPLOT data=data_01_output;
	series x=time y=Efflux / lineattrs=(thickness=3px) group=group
		markers markerattrs=(size=10pt) DATALABEL DATALABELATTRS=(Color=grey Family="Arial" Size=12
        Style=Italic Weight=Bold);

	yaxis
	 values=(8 to 12 BY 1) label='Efflux (Mean)'
	 labelattrs=(size=12pt weight=bold color=gray33)
	 valueattrs=(size=12pt weight=bold color=gray33)
	 offsetmin=0 offsetmax=0 grid minor minorcount=1;
	 
	xaxis
	 values=(1 to 3 BY 1) label='Timepoint'
	 labelattrs=(size=12pt weight=bold color=gray33)
	 valueattrs=(size=12pt weight=bold color=gray33)
	 offsetmin=0 offsetmax=0 grid minor minorcount=1;
	
/* 	FORMAT timepoint_graph timepoint_graph_.; */
	
	TITLE "Change in Efflux Over Time (Mean)";
/* 	TITLE2 "PROMIS Pain Intensity Score"; */
	footnote "Footnote: CONFIDENTIAL";
RUN;

I'm not following this at all. You don't have to control the number of decimal places in the output of PROC MEANS/PROC SUMMARY/PROC UNIVARIATE to run PROC SGPLOT.

--
Paige Miller
_maldini_
Barite | Level 11

This is the current graph. I'd like to limit the decimal places to 2. 

Screen Shot 2021-11-19 at 9.04.08 AM.png

PaigeMiller
Diamond | Level 26

If all you want is means and standard deviations, you should use PROC MEANS/PROC SUMMARY rather than PROC UNIVARIATE. PROC UNIVARIATE calculates a lot of statistics that you aren't asking for, so its probably inefficient to use for this purpose.

 

In PROC MEANS, there is a MAXDEC= option to specify the maximum number of decimal places in the output.

--
Paige Miller

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 3128 views
  • 1 like
  • 2 in conversation