BookmarkSubscribeRSS Feed
JasonNC
Quartz | Level 8
Message was edited by: JasonNC Message was edited by: JasonNC
6 REPLIES 6
Cynthia_sas
SAS Super FREQ
Hi:
Part of the etiquette when you ask a question is showing all your code, showing working code and giving some idea of what your program is doing. WORKING code means showing either ALL the program -- possibly code that someone would be willing to cut and paste. All of your "Xpt" and "X%" and "@X" means that folks have to make guesses and modify your code to try anything out.

In addition, it would be useful to see ALL of your code. Also, you have some syntax errors in your posted code (missing semi-colons) that would not provide any results at all. And then, there are other questions about your program. For example, how are PHCOUNT, RECCOUNT and CRCOUNT defined??? As NOPRINT variables???

As an aside, generally, techniques like this with absolute pointers like @20 and @80 do not work with ODS destinations:
[pre]
COMPUTE after _PAGE_/ STYLE={JUST=R ASIS=ON FONT_SIZE=Xpt FONT_FACE=COURIER } <--- missing semicolon here!!!
LINE @20 " *** xxxx *** " @65 ERRORPHCOUNT.sum comma5.
@80 ERRORRECOUNT.sum comma5.
@96 ERRORCRCOUNT.SUM comma5.
@112 TOTAL5 comma5.;

LINE @22 " TOTAL ---- xxx:" @X total1 best5. @X total2 best5. @X TOTAL3 BEST5. @X TOTAL4 BEST5. ;
ENDCOMP;
[/pre]

Can you post all of your PROC REPORT step??? Or else a simplified version of your program -- but a simplified version that WORKS. Also, can you explain what you're doing with your COMPUTE BEFORE and your LINE statements -- it seems that you are calculating your own totals and then trying to place those totals in specific locations -- I'm curious why you're not using BREAK after ID or BREAK after CODE1 if you want totals at the bottom of every page.

cynthia
JasonNC
Quartz | Level 8
Message was edited by: JasonNC Message was edited by: JasonNC
Cynthia_sas
SAS Super FREQ
Hi:
It might be useful to revisit the documentation on the RULES attribute (and you might want to look at the doc for BORDER styles, too).

For your convenience, the possible values for RULES are:
[pre]
Value Meaning
ALL Between all rows and columns
COLS Between all columns
GROUPS Between the table header and the table and between the table and the table footer, if there is one
NONE No rules anywhere
ROWS Between all rows
[/pre]

from:
http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/a002972093.htm#a002978401


When you use the GROUPS value for the RULES attribute, you would normally NOT see a line at a total (see #1 below) if the total was produced by a PROC REPORT BREAK or RBREAK statement. However, as soon as you use a LINE statement for COMPUTE AFTER _PAGE_, you are essentially creating a TABLE FOOTER.

In the programs below, note the behavior in the 2 different outputs. Report #1 has no line before the total (because there is no table footer in #1). But Report #2 has a LINE statement -- which automatically creates a table footer, so there is a solid line above the table footer.

Also, are you seeing a DASHED border in your output???? I do not see a dashed line in my output. I suspect that is because the various borderstyle attributes are only valid in the RTF and Markup family destinations and PDF does not fall into those categories. (See #3)

If you use RULES=GROUPS and the LINE statement with PROC REPORT, then you are seeing the expected behavior from RULES=GROUPS.

cynthia
[pre]
ods pdf file='c:\temp\withbreak.pdf';
PROC REPORT DATA=sashelp.class(obs=5) NOWD MISSING SPLIT='|'
STYLE(HEADER)={FONT_FACE=COURIER BACKGROUND=_UNDEF_ FONT_SIZE=10pt}
STYLE(REPORT)={RULES=GROUPS FRAME=VOID BORDERSTYLE=DASHED FONT_SIZE=10pt }
STYLE(COLUMN)={BACKGROUND=WHITE FOREGROUND=black FONT_FACE=COURIER
FONT_SIZE=10pt };
title "1) Rules= GROUPS with BREAK statement";
column age name sex height weight;
define age / order;
break after age / summarize;
run;
ods pdf close;

ods pdf file='c:\temp\withline.pdf';
PROC REPORT DATA=sashelp.class(obs=5) NOWD MISSING SPLIT='|'
STYLE(HEADER)={FONT_FACE=COURIER BACKGROUND=_UNDEF_ FONT_SIZE=10pt}
STYLE(REPORT)={RULES=GROUPS FRAME=VOID BORDERSTYLE=DASHED FONT_SIZE=10pt }
STYLE(COLUMN)={BACKGROUND=WHITE FOREGROUND=black FONT_FACE=COURIER
FONT_SIZE=10pt };
title "2) Rules= GROUPS with BREAK -and- LINE statement";
column age name sex height weight;
define age / order;
break after age / summarize;

COMPUTE after _PAGE_/ STYLE={JUST=R ASIS=ON FONT_SIZE=10pt FONT_FACE=COURIER };
LINE @20 " *** vvvvv *** "
@65 'wwwww'
@80 'xxxxx'
@96 'yyyyy'
@112 'zzzzz';
ENDCOMP;
run;
ods pdf close;


ods html file='c:\temp\useborderstyle.html' style=rtf;
ods rtf file='c:\temp\useborderstyle.rtf';
PROC REPORT DATA=sashelp.class(obs=5) NOWD MISSING SPLIT='|'
STYLE(HEADER)={FONT_FACE=COURIER BACKGROUND=_UNDEF_ FONT_SIZE=10pt}
STYLE(REPORT)={BORDERTOPSTYLE=DASHED borderbottomstyle=dotted
borderleftstyle=solid borderrightstyle=double
borderwidth=5 FONT_SIZE=10pt }
STYLE(COLUMN)={BACKGROUND=WHITE FOREGROUND=black FONT_FACE=COURIER
FONT_SIZE=10pt };
title "3) Default style shows borderstyle usage";
column age name sex height weight;
define age / order;
break after age / summarize;

COMPUTE after _PAGE_/ STYLE={JUST=R ASIS=ON FONT_SIZE=10pt FONT_FACE=COURIER };
LINE @20 " *** vvvvv *** "
@65 'wwwww'
@80 'xxxxx'
@96 'yyyyy'
@112 'zzzzz';
ENDCOMP;
run;
ods _all_ close;
[/pre]
JasonNC
Quartz | Level 8
Hi Cynthia,

Thanks for your patience and support.The line is not dashed.

For my report there is a break on two variables.

one is on ID and other one is on STATUSCODE.So i am using BY statement.

can we use two variables in Break statement .

I dont want to summarize.

The totals are calculated in the dataset.I just want to print them.so i am using LINE statement.

If you want more information I can give it.
Cynthia_sas
SAS Super FREQ
Hi:
You can't use 2 variables in 1 BREAK statement, but you CAN have 2 different BREAK statements.

And, yes, there is a way to underline in PDF -- using the text-decoration style attribute. But it ONLY underlines the words in each HEADER. It does NOT put an underline under the entire header row (in other words, it doesn't look like RULES=GROUPS.

However, the numbers that appear on the summary line from a BREAK statement can be altered in a COMPUTE block. See the example below. For the break on AGE, I put the number 99.9 for the HEIGHT cell and the number 88.8 in the cell when the break variable is SEX. I use different numbers for the WEIGHT summary line.

cynthia
[pre]

ods listing close;
ods pdf file='c:\temp\text_dec_br4.pdf';
PROC REPORT DATA=sashelp.class NOWD MISSING SPLIT='|'
STYLE(HEADER)={textdecoration=underline FONT_FACE=COURIER BACKGROUND=_UNDEF_
FONT_SIZE=10pt}
STYLE(REPORT)={RULES=none FRAME=VOID FONT_SIZE=10pt }
STYLE(COLUMN)={BACKGROUND=WHITE FOREGROUND=black FONT_FACE=COURIER
FONT_SIZE=10pt };
where age in (12, 14);
title "4) Using TEXTDECORATION=UNDERLINE and BREAK";
column age sex name height weight;
define age / order;
define sex / order;
define name / order;
define height / sum;
define weight / sum;
break after age / summarize page;
break after sex / summarize;

compute name;
if upcase(_break_) = 'SEX' then name='Sub Tot';
else if upcase(_break_) = 'AGE' then name = 'Total';
endcomp;
compute after sex;
line ' ';
endcomp;
compute height;
if upcase(_break_) = 'SEX' then height.sum=88.8;
else if upcase(_break_) = 'AGE' then height.sum = 99.9;
endcomp;
compute weight;
if upcase(_break_) = 'SEX' then weight.sum=44.4;
else if upcase(_break_) = 'AGE' then weight.sum = 55.5;
endcomp;
compute after _page_;
line 'Note how I put totally fake numbers on the summary lines created by the BREAK';
line 'These assignment statements could write OTHER numbers into summary cells';
endcomp;
run;
ods _all_ close;
[/pre]
JasonNC
Quartz | Level 8
Hi Cynthia,

If i want to underline column headers is there any way to do it in ODS PDF proc report.without using [RULES=GROUPS].

I know we cannot use HEADLINE option it doesnt work in PDF.It works only in LISTING.

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
  • 6 replies
  • 2403 views
  • 0 likes
  • 2 in conversation