BookmarkSubscribeRSS Feed
PeterMehnert
Calcite | Level 5
I use PROC REPORT to produce a simple frequency table from two character variables which are categorized. The Table is produced via ODS as PDF output with an tailored style definition.
The cells simply contain the frequency counts from all the possible combinations of the categories. Now I want to apply a different format to the cells (eg. a COMMAX format). I tried many things in the style definition and the report definition but it didn't work at all. I also checked out the Doc how to apply the format.

Any hints?
Thanks
Peter
4 REPLIES 4
David_SAS
SAS Employee
Peter,

You can use the FORMAT option on the DEFINE statement, e.g.:
[pre]
define priority/order order=internal "Priority" format=prty10.;
[/pre]

-- David Kelley, SAS
PeterMehnert
Calcite | Level 5
David,

thanks for your response.

The problem is that (in your example) priority is a character variable. Therefore a numeric format wouldn't work. The frequency values in the table are printed in best. format (eg. 23419), but the customer wants to have it in commax. format like 23.419.

Thanks
Peter
Cynthia_sas
SAS Super FREQ
Hi, Peter:
Here's a thought, are you explicitly using the N statistic in your PROC REPORT? If you are taking the default count for character variables in your table, you might be able to achieve what you want by trying something like this.
[pre]
column Product Region,N;
define Product / group;
define Region / across;
define N / format=commax6. 'CNT';
[/pre]

Proc Tabulate might also serve your needs better because with PROC TABULATE, you can apply a format to all the data cells on the TABULATE statement:
[pre]
PROC TABULATE data=something format=commax6.;
[/pre]

cynthia
PeterMehnert
Calcite | Level 5
Hi Cynthia,

thanks for your response. Your first proposal did work! I already used the N statistic for the row totals, but using an alias like

column Product Region,N=NCELL N;
define Product / group;
define Region / across;
define NCELL / format=commax6. 'CNT';
define N / format=commax6. 'TOT';

brought the desired results.

Thanks again
Peter

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 802 views
  • 0 likes
  • 3 in conversation