The SAS Output Delivery System and reporting techniques

Proc report - deriving % for r break after values

Reply
Regular Learner
Posts: 1

Proc report - deriving % for r break after values

 

 

As per below mentioned code,  instead of % values it is calculating sum as per r break after

 

Could you suggest how to derive % for r break after values

 

Output table attached herewith


options missing='0';
Proc Report data=DTR.NH_TAT_Rpt headskip headline nowd missing
STYLE(Report)={FONT_FACE='Zurich BT' FONT_SIZE=10PT FONT_STYLE=ROMAN}
STYLE(COLUMN)={FONT_FACE='Zurich BT' FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#000000 BACKGROUND=#FFFFFF}
STYLE(HEader)={FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#972926}
style(lines)=[FOREGROUND=black] style=[just=left];
Title j=l font='Zurich BT' height=3 color=black 'Settled (Paid+Rejected)Claims TAT met and missed%';
column ("Settled Claims TAT" REGISTER_FT TAT_Status,(n pct) Total_Count Total_Percentage );
where Final_Status in ("Paid","Closed","Rejected","Rejected") and Revised_DATE_OF_SETTLEMENT ne . ;
define REGISTER_FT/group "Product" order=internal STYLE(HEader)={FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#972926};
define n/"Claim Count";
define TAT_Status/across STYLE(HEader)={FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#972926};
define Total_Count/computed "Total Count" STYLE(HEader)={FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#972926};
define Total_Percentage/computed "Total %" f=percent8.2 STYLE(HEader)={FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT FONT_STYLE=ROMAN FOREGROUND=#FFFFFF BACKGROUND=#972926};
define pct /computed "%" f=percent8.2;
rbreak after / summarize ;
compute after;
REGISTER_FT="Grand Total";
call define(_row_,"Style","style=[FONT_FACE='Zurich BT' FONT_WEIGHT=BOLD FONT_SIZE=10PT foreground=white background=#972926]");
endcomp;
compute before REGISTER_FT;
Overall =sum(_c2_ , _c4_);
endcomp;
compute pct;
_c3_ = _c2_ / Overall;
_c5_ = _c4_ / Overall;
endcomp;
compute Total_Count;
Total_Count =sum(_c2_ , _c4_);
endcomp;
compute Total_Percentage;
Total_Percentage =sum(_c3_ , _c5_);
endcomp;
run;
quit;

PROC Star
Posts: 1,842

Re: Proc report - deriving % for r break after values

Posted in reply to ukpalnati

Please work more so we work less to help you. There is way too much code that is irrelevant to your question.

 

Simplify your problem to a bare-bone example.

 

Maybe this will help:

 

proc report data=SASHELP.CLASS nowd;
  where NAME =:'J';
  column SEX NAME N;
  define SEX    / group;
  define NAME   / order;
  define PCTSEX / computed;
  define N      / noprint;
  compute before  ;
    TOT=N;
  endcomp;
  break after SEX /style=[just=left];
  compute after SEX ;
    PCTSEX=N/TOT;
    line N 2. ' ' SEX $1. ' (' PCTSEX percent6.0 ')' ;
  endcomp;
run;

 

Sex Name
F Jane
  Janet
  Joyce
  Judy
 4 F (  57% )
M James
  Jeffrey
  John
 3 M (  43% )

 

 

Ask a Question
Discussion stats
  • 1 reply
  • 168 views
  • 0 likes
  • 2 in conversation