Help using Base SAS procedures

Formatting PROC MEANS output

Reply
Contributor
Posts: 32

Formatting PROC MEANS output

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;

Super Contributor
Posts: 345

Re: Formatting PROC MEANS output

Posted in reply to f_rederik

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.

Regular Contributor
Posts: 151

Re: Formatting PROC MEANS output

Posted in reply to f_rederik

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.

Contributor
Posts: 32

Re: Formatting PROC MEANS output

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!

Super User
Posts: 11,343

Re: Formatting PROC MEANS output

Posted in reply to f_rederik

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.);


Ask a Question
Discussion stats
  • 4 replies
  • 1455 views
  • 6 likes
  • 4 in conversation