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.);
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.