For example:
if we create a format:
proc format;
value quantityf
low - <0 = "Negative"
0 - 0 = "Zero"
1 - high = "Positive"
. = "Missing";
run;
we can easily apply it to proc freq procedure:
proc freq;
table quantity*group;
format quantity quantityf.;
run;
how to do the same with proc tabulate?
proc tabulate;
class quantity group;
tables quantity, group;
run;
Hi,
You need to use the format option in proc tabulate on then you will be able to apply the formats,
you can write
proc tabulate data=datasetname format=formatname;
class quantity group;
tables quantity, group;
format variablename format.;
run;
Thanks,
Jagadish
Hi,
You need to use the format option in proc tabulate on then you will be able to apply the formats,
you can write
proc tabulate data=datasetname format=formatname;
class quantity group;
tables quantity, group;
format variablename format.;
run;
Thanks,
Jagadish
For your classification variables you do it exactly the same as in your proc freq example.
Jagadish's example is an easy way to control a lot of summary statistics at once.
You can also override or provide specific formats for the summary statistics in a table statement:
Table classvariable,
variable * (n*f=comma6. mean*f=f6.2 stddev*f=3.1);
for example to provide counts in comma format, mean with 2 decimals and standard deviation with one decimal.
Thanks Jagadish and Ballardw! Exactly what I was looking for.
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.