BookmarkSubscribeRSS Feed
f_rederik
Obsidian | Level 7

Hi there

I am having some issues with formatting the output of a PROC MEANS.

1) I would like to control the displayed values for the computed statistics, applying formats such as COMMAX32. and best4.0 to some of the statistics. In the below code, the FORMAT statement seems to have no effect? What am I missing?

2) I was hoping to be able to suppress the column in the output table displaying the variable names, leaving only the variable labels. Is this possible, and if so how?

Thanks for your kind assistance Smiley Happy



PROC MEANS DATA=WORK.SORTTempTableSorted

FW=12
MAXDEC=1
PRINTALLTYPES
CHARTYPE
QMETHOD=OS

MEAN
MIN
MAX
SUM
MEDIAN;


VAR     M_Kundelengde Alder Aktive_Konti_N Totalpakke_Bol Avtalegiro_Ant Bank_Id_Ant Debetkort_Ant
      Lonns_Brukskonto_Ant Nettbank_Ant Reservekort_Ant Spareavtale_Ant Saldo_MNOK;

FORMAT     Alder BEST4.
      Saldo_MNOK COMMAX32.;

LABEL    Totalpakke_Bol="Totalpakke (1 = Har totalpakke)"
      Saldo_MNOK="Saldo";

RUN;

4 REPLIES 4
andreas_lds
Jade | Level 19

Afaik proc means has no option to control the number of decimal places for individual variables/statistics. The options "maxdec" sets the number of decimal places for all generated statistics.

Keith
Obsidian | Level 7

If you want to have better control over the formatting then your best options are to use PROC TABULATE or PROC REPORT, you can replicate all the calculations with these.

f_rederik
Obsidian | Level 7

Thanks guys - won't spend more time on PROC MEANS then but rather look at the TABULATE and REPORT procs! Thanks. Will update post once I find sort this out!

ballardw
Super User

The basic idea with Proc Tabulate is you can specify the display format with the selected statistic.

Part of an example:

class classvar;

var var1;

table classvar,var1*(mean*f=comma6.1 std*f=f6.4 min*f=mycustomformat.);


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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 25190 views
  • 8 likes
  • 4 in conversation