BookmarkSubscribeRSS Feed
MohamedS
Obsidian | Level 7
Hi,

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

thanks
4 REPLIES 4
Tim_SAS
Barite | Level 11
Quite possibly, but I'd have to have more details about exactly what it is you want to do.
MohamedS
Obsidian | Level 7
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
Cynthia_sas
SAS Super FREQ
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
MohamedS
Obsidian | Level 7
Hi Cynthia,

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

thanks

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
  • 1119 views
  • 0 likes
  • 3 in conversation