The SAS Output Delivery System and reporting techniques

Formatting Cells with ODS/PROC REPORT

Reply
Occasional Contributor
Posts: 5

Formatting Cells with ODS/PROC REPORT

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
SAS Employee
Posts: 174

Re: Formatting Cells with ODS/PROC REPORT

Posted in reply to PeterMehnert
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
Occasional Contributor
Posts: 5

Re: Formatting Cells with ODS/PROC REPORT

Posted in reply to David_SAS
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
SAS Super FREQ
Posts: 8,868

Re: Formatting Cells with ODS/PROC REPORT

Posted in reply to PeterMehnert
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
Occasional Contributor
Posts: 5

Re: Formatting Cells with ODS/PROC REPORT

Posted in reply to Cynthia_sas
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
Ask a Question
Discussion stats
  • 4 replies
  • 157 views
  • 0 likes
  • 3 in conversation