The SAS Output Delivery System and reporting techniques

Row Format

Reply
Contributor
Posts: 25

Row Format

Hi,

is anyone know if we can reformat specific row in the report created by "Proc Report"?

thanks
Super Contributor
Posts: 394

Re: Row Format

Quite possibly, but I'd have to have more details about exactly what it is you want to do.
Contributor
Posts: 25

Re: Row Format

Hi Tim,

thank for your reply. what I'd like to do as follow:
if I have a table this table has numbers with formats i.e dollar12.3 and there is one row in between should be percentage with another format %98, 11% ...

so, how can I make only one row inside this table with different format i.e. with percentage.

regards
SAS Super FREQ
Posts: 8,740

Re: Row Format

Hi:
Here's a PROC REPORT example that formats the summary line differently. Note how with PROC REPORT, you are changing the format in a CALL DEFINE Statement -- so each column has its own CALL DEFINE and while I have given them all DOLLAR formats, notice how INVENTORY is formatted as dollar15.0 on the summary line, while the other numeric columns are formatted with dollar15.2 -- Also notice how the format for only some of the cells for Asia, Pacific and Canada rows have been changed.
[pre]
ods html file='c:\temp\diff_fmt.html' style=egdefault;

proc report data=sashelp.shoes nowd;
title 'different format';
column region sales inventory returns;
define region /group;
define inventory/sum f=comma15.2;
define returns/ sum f=comma15.2;
define sales /sum f=comma15.2;
rbreak after /summarize;
compute sales ;
if region = 'Canada' then
call define (_col_,'FORMAT',"dollar15.2");

if _break_ = '_RBREAK_' then
call define (_col_,'FORMAT',"dollar15.2");
endcomp;

compute inventory ;
if region = 'Pacific' then
call define (_col_,'FORMAT',"dollar15.2");

if _break_ = '_RBREAK_' then
call define (_col_,'FORMAT',"dollar15.0");
endcomp;

compute returns ;
if region = 'Asia' then
call define (_col_,'FORMAT',"dollar15.2");

if _break_ = '_RBREAK_' then
call define (_col_,'FORMAT',"dollar15.2");
endcomp;

compute after;
call define (_row_,'STYLE','style={background=pink}');
endcomp;
run;

ods html close;
[/pre]

You would use different syntax for PROC TABULATE if you wanted to apply a different format to a summary row. And this technique will not work for PROC PRINT at all.

cynthia
Contributor
Posts: 25

Re: Row Format

Hi Cynthia,

Thanks a lot for your Support. your answer is very helpfull.

thanks
Ask a Question
Discussion stats
  • 4 replies
  • 252 views
  • 0 likes
  • 3 in conversation