BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Having searched the web, form and documentation I am stil stumped on something that must be really simple...how to format the values in a tabulate report. The default gives nnnnnnnnnn.nn , but I need comma format to make the report more readable.

This is the simplest of cross-tab reports.
__________________________________________________________
Code:

PROC TABULATE
DATA=ECLIB000.ALL_EVENTS

OUT=SASUSER.STABSummaryTablesALL_EVENTS(LABEL="Summary Tables for ECLIB000.ALL_EVENTS")

;
VAR amount;
CLASS TO_Product / ORDER=UNFORMATTED MISSING;
CLASS FROM_Product / ORDER=UNFORMATTED MISSING;
TABLE
/* ROW Statement */
FROM_Product
all = 'Total' ,
/* COLUMN Statement */
TO_Product *(amount=' ' * Sum=' ' )
all = 'Total' *(amount=' ' * Sum=' ' ) ;
;

RUN;
____________________________________________________________________

It would be most helpful if someone would show me where the formatting instructions need to go in order to produce COMMA16. "amount" output.

Thanks in advance !
DBM
5 REPLIES 5
Cynthia_sas
Diamond | Level 26
Hi:
If statistics based on AMOUNT are all you have in your table, then a very simple way to achieve the formatting you want is to do this:
[pre]
proc tabulate data=xxxx.data f=comma16.
out=yyyyyy.data(label="Something");
[/pre]

add the f= or format= option to the PROC TABULATE statement. It can go anywhere, but must be placed before the semi-colon that ends the statement.

In more complicated situations, such as where you want some statistics to have a comma16. format, but other statistics to have the comma16.2 format (for example), you would then need to request the format in the TABLE statement. Like this:
[pre]
table Product all,
othervar*(amount=' '*Sum=' '*f=comma16.2)
all*(amount=' '*Sum=' '*f=comma16.0);
[/pre]

cynthia
deleted_user
Not applicable
Excellent, and thank you. This works nicely.

Related question: is there any way to do this within the EG wizard ? It would seem to be an obvious requirement to format output, yet I cannot see where one has the opportunity to do so.

Thanks again for your attention and especially promptness.
Cynthia_sas
Diamond | Level 26
Hi:
Sadly, I do not have EG on this machine to double check, but I have some memory of right-clicking on the variable name or the statistic name and choosing Properties in order to assign a format.

cynthia
deleted_user
Not applicable
Again thanks for your attention, Cynthia.

In EG tabulate is accessed through a wizard. When one selects the variable(s) to place in the tab construct there is no way to specify format. That is where it belongs (second screen in the EG wizard) - a useful addition - perhaps could be added to the development queue foir the benefit of the Base SAS challenged. 😉
Cynthia_sas
Diamond | Level 26
HI...my memory is that when you drag and drop the variables into the table designer in the Summary Tables Task, that there is a way to Right-click on the variable name and set the format. I think it's Properties off the Right-click menu that comes up.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 9165 views
  • 1 like
  • 2 in conversation