BookmarkSubscribeRSS Feed
willy0625
Calcite | Level 5

Hello SAS users.

I am almost done with the following proc report... except I am missing an overline for the total bar in the last line.

The following is what I want to see. Can anyone please tell me what I should add in my SAS code to achieve this?

.

.

.

1234    123     231     xxx    xxx

total   etc     etc    etc    etc

Many thanks

DATA sample;

INPUT no $ Bad Good Reject Total;

CARDS;

(0) 3 1635 163 18366

(1) 2 1772 126 14710

(2) 5 3912 138 18261

(3) 7 5614 245 30824

;

RUN;

ods rtf file="reportstyles.html" style=Journal BODYTITLE;

      TITLE1 "Table 1.&i: Analysis: Adverse";

      FOOTNOTE;

      PROC REPORT DATA=sample NOWD

            STYLE(header) = [font=(Arial,2) JUST=CENTER]

            STYLE(report) = [font=(Arial,1.8) borderwidth=1 CELLSPACING=0.5 just=CENTER WIDTH=1100]

            STYLE(column) = [font=(Arial,2)just=center];

            COLUMN (no good bad Reject total total=total_pct BR GB DR);

            DEFINE no / ORDER;

            DEFINE good / ANALYSIS "Good" FORMAT=comma10.;

            DEFINE bad / ANALYSIS "Bad" FORMAT=comma10.;

            DEFINE Reject / ANALYSIS "Declined" FORMAT=comma10.;

            DEFINE BR / COMPUTED "Bad Rate" FORMAT=percent6.1;

            DEFINE GB / COMPUTED "GB Odds" FORMAT=6.1;

              DEFINE DR / COMPUTED "Decline rate" FORMAT=percent6.2;

            DEFINE total / ANALYSIS "Total" FORMAT=comma10.;

              DEFINE total_pct / PCTSUM "PoP%" FORMAT=percent6.2;

            COMPUTE BR;

                  BR=bad.sum/(good.sum+bad.sum);

            ENDCOMP;

            COMPUTE GB;

                  GB = good.sum/bad.sum;

            ENDCOMP;

              COMPUTE DR;

                  DR = Reject.sum/total.sum;

            ENDCOMP;

            COMPUTE AFTER;

                  no = 'Total';

            ENDCOMP;

              RBREAK AFTER/ SUMMARIZE SKIP OL  ;

      RUN;

ods rtf close;

Update:

I just read from  http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473629.htm that UL doesn't come through to ODS destinations, which is disappointing for me because I want this table in a word document file. I am quite lost what to do now Smiley Sad

2 REPLIES 2
Ksharp
Super User

It is so weird. SAS do not allow to change bordertopcolor attribute of summary .

My workaround is awkward by using line statement. I do not think you like it.

Maybe Cynthia@sas can use proc template to tailor it .

Or there is a smart way?

DATA sample;

INPUT no $ Bad Good Reject Total;

CARDS;
(0) 3 1635 163 18366
(1) 2 1772 126 14710
(2) 5 3912 138 18261
(3) 7 5614 245 30824
;
RUN;


ods rtf file="c:\reportstyles.rtf"  BODYTITLE ;
      TITLE1 "Table 1.i: Analysis: Adverse";
      FOOTNOTE;

      PROC REPORT DATA=sample NOWD 
STYLE(report) = [ bordercolor=white font=(Arial,1.8) borderwidth=1 CELLSPACING=0.5 just=CENTER WIDTH=1100]

        STYLE(header) = [ bordertopcolor=black borderbottomcolor=black font=(Arial,2) JUST=CENTER background=white ]
            STYLE(column) = [  bordertopcolor=white  font=(Arial,2)just=center ]
            STYLE(summary)=[foreground=white height=.01 bordertopcolor=black borderbottomcolor=black ]
STYLE(lines)=[bordertopcolor=black borderbottomcolor=black ]
              
             ;

            COLUMN (no good bad Reject total total=total_pct BR GB DR);
            DEFINE no / ORDER;
            DEFINE good / ANALYSIS "Good" FORMAT=comma10.;
            DEFINE bad / ANALYSIS "Bad" FORMAT=comma10.;
            DEFINE Reject / ANALYSIS "Declined" FORMAT=comma10.;
            DEFINE BR / COMPUTED "Bad Rate" FORMAT=percent6.1;
            DEFINE GB / COMPUTED "GB Odds" FORMAT=6.1;
              DEFINE DR / COMPUTED "Decline rate" FORMAT=percent6.2;
            DEFINE total / ANALYSIS "Total" FORMAT=comma10.;
              DEFINE total_pct / PCTSUM "PoP%" FORMAT=percent6.2;

 

            COMPUTE BR;

                  BR=bad.sum/(good.sum+bad.sum);

            ENDCOMP;

            COMPUTE GB;

                  GB = good.sum/bad.sum;

            ENDCOMP;

              COMPUTE DR;
                  DR = Reject.sum/total.sum;

            ENDCOMP;

            COMPUTE AFTER;

                  line 'Total:'  @12 good.sum comma10. @ 34 bad.sum comma10.;

            ENDCOMP;    

        RBREAK AFTER/ SUMMARIZE SKIP OL  ;
 ;

      RUN;

ods rtf close;

Ksharp

Ksharp
Super User

If you want bold summary line:

      PROC REPORT DATA=sample NOWD

            STYLE(header) = [font=(Arial,2) JUST=CENTER]

            STYLE(report) = [font=(Arial,1.8) borderwidth=1 CELLSPACING=0.5 just=CENTER WIDTH=1100]

            STYLE(column) = [ font=(Arial,2)just=center]

           STYLE(summary)=[fontweight=bold ]

Ksharp

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1168 views
  • 3 likes
  • 2 in conversation