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
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;
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.
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.
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!
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.);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.