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

I treied to make all my statistical outputs to round 2 decimals. For example, here is code:

 

ods rtf file='c:\SAS\MeanOutput.rtf';
proc means data = sashelp.class nmiss N min max mean std;
var _numeric_ ;
format _numeric_ comma10.2;
run;
ods rtf close;

 

where the format statement doen't work. Any help or suggestion would be appreciated. Thank you.

 

Louis

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Use the maxdec option like this 🙂

 

proc means data = sashelp.class nmiss N min max mean std maxdec = 2;
var _numeric_ ;
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Use the maxdec option like this 🙂

 

proc means data = sashelp.class nmiss N min max mean std maxdec = 2;
var _numeric_ ;
run;
louis_usa
Fluorite | Level 6
It worked like a charm. Thank you so much!
art297
Opal | Level 21

You already got a satisfactory answer, but that only changed the decimal places. It didn't apply the format you wanted (i.e. comma12.2).

 

If you need to change the formats for proc means, you can do that using proc template. e.g.:

 

ods path(prepend) work.templat(update);
proc template;
 edit base.summary;
  edit mean;
   format=comma12.2;
  end;
  edit sum;
   format=comma12.2;
  end;
  edit min;
   format=comma12.2;
  end;
  edit max;
   format=comma12.2;
  end;
  edit stddev;
   format=comma12.2;
  end;
 end;
run;

ods rtf file='/folders/myfolders/MeanOutput.rtf';
proc means data = sashelp.class nmiss N min max mean std;
  var _numeric_ ;
run;
ods rtf close;

proc template;
 delete base.summary;
run;

Art, CEO, AnalystFinder.com

 

louis_usa
Fluorite | Level 6
Correct, I'm more interested in the change of the display. But thank you so much for showing me alternative way doing the format.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 964 views
  • 0 likes
  • 3 in conversation