Help using Base SAS procedures

problem with RBREAK Statement in PROC report

Accepted Solution Solved
Reply
Contributor
Posts: 70
Accepted Solution

problem with RBREAK Statement in PROC report

Hi All,

Thanks in Advance,

I want to display sum of all the min and max values for fee. that is the reason i used RBREAK statement. for below code i can get sum for only height. so i need to get sum for min and max also.

proc report data = sasuser.admit out = want;

columns actlevel (min max),fee height;

define fee/analysis sum;

define actlevel/group;

rbreak after/summarize dol dUl;

run;

Thanks.,

Yaswanth


Accepted Solutions
Solution
‎02-28-2013 05:26 AM
Super Contributor
Posts: 276

Re: problem with RBREAK Statement in PROC report

Hi..

Better to use To proc reports to meet your requirement.

proc report data = sasuser.admit out = want;

columns actlevel (min max),fee height;

define fee/analysis sum;

define actlevel/group;

rbreak after/summarize dol dUl;

run;

PRoc report data=want;

columns actlevel _C2_ _C3_ Height;

define Actlevel/"Actlevel";

define _c2_/"Min/Fee";

define _c3_/"Max/Fee";

Define Height/"Height";

rbreak after/summarize dul dol;

run;

Thanks&regards.

Sanjeev.K

View solution in original post


All Replies
Frequent Contributor
Posts: 81

Re: problem with RBREAK Statement in PROC report

Hi,

Try this,

proc report data = sasuser.admit out = want;

columns actlevel (min max),fee height;

define fee/analysis sum;

define actlevel/group;

break after actlevel/ ol skip summarize;

rbreak after/summarize dol dUl;

run;

/Daman

Contributor
Posts: 70

Re: problem with RBREAK Statement in PROC report

Hi Daman,

Thanks for your quick reply

I have tried with your code. but not meeting exact requirement what i want is, i need to display sum of _C2_ column value in end of the report, same as for the column height..

Thanks,

yaswanth

SAS Super FREQ
Posts: 8,743

Re: problem with RBREAK Statement in PROC report

Hi:

  I suggest you change the code as shown below. If you also want SUM for FEE, then remove the SUM statistic from the DEFINE statement and put it in the parentheses with the MIN and MAX statistics. Otherwise, with SUM explicitly in the DEFINE statement, you are sort of giving PROC REPORT conflicting instructions...with MIN and MAX in the COLUMN statement, but then SUM in the DEFINE statement.

cynthia

proc report data = sasuser.admit nowd out = want;

columns actlevel (min max sum),fee height;

define fee/analysis ;

...more code...

Contributor
Posts: 70

Re: problem with RBREAK Statement in PROC report

Hi Cynthia,

Thank you for your reply..sorry for delayed response, because i was on holiday..

actually what i want to display is, for the variables(minfee, maxfee). i required to get the sum of "min fee" and sum of  "max fee". should be like below displayed.

rbreak_want.bmp

when i trying to execute above code i am getting min value for "min fee", max value for "maxfee" while using rbreak like below.

rbreak.JPG

Please help..

Thanks,

Yaswanth J

Occasional Contributor
Posts: 5

Re: problem with RBREAK Statement in PROC report

Hi Yaswanth

Try this...i think it may help you

proc sort data= sasuser.admit out = admit;

   by actlevel;

   run;

proc univariate data = admit;

    var  fee height weight;

  by actlevel;

  output out = admit1

     min= min1

  max = max1

  sum = sum1 sum2 sum3;

  run;

proc report data = admit1 nowd list split = "/";

  column actlevel   sum2 sum3 sum1 max1 min1;

    define actlevel/"/ Actlevel" group width = 8;

  define sum2 / " /Height" sum;

  define sum3 / " /Weight" sum;

  define sum1 / "/Fee" sum;

  define max1/  "Max / Fee"sum;

  define min1/  "Min / Fee"sum;

  rbreak after/ summarize  dol ;

run;

or U can try this if you want

proc report data = admit1 nowd list split = "/";

  column actlevel   sum2 sum3 sum1 max1 min1;

    define actlevel/"/ Actlevel" group width = 8;

  define sum2 / " /Height" sum;

  define sum3 / " /Weight" sum;

  define sum1 / "/Fee" sum;

  define max1/  "Max/____/ Fee"sum;

  define min1/  "Min/____/Fee"sum;

  rbreak after/ summarize  dol ;

run;

Valued Guide
Posts: 632

Re: problem with RBREAK Statement in PROC report

I would be uncomfortable with having the sum of the minimums in the same column as the minimums - too easy to be misinterpreted.  The LINE statement could be used (code adapted here for testing against the CLASS data set.

proc report data = sashelp.class nowd;

columns sex (min max),age height;

define sex/group;

define age/analysis sum;

rbreak after/summarize;

compute height;

   if _break_=' ' then do;

      c2 + _c2_;

      c3 + _c3_;

   end;

endcomp;

compute after;

   line 'Sum of minimums' c2 3.;

   line 'Sum of maximums' c3 3.;

endcomp;

run;

Solution
‎02-28-2013 05:26 AM
Super Contributor
Posts: 276

Re: problem with RBREAK Statement in PROC report

Hi..

Better to use To proc reports to meet your requirement.

proc report data = sasuser.admit out = want;

columns actlevel (min max),fee height;

define fee/analysis sum;

define actlevel/group;

rbreak after/summarize dol dUl;

run;

PRoc report data=want;

columns actlevel _C2_ _C3_ Height;

define Actlevel/"Actlevel";

define _c2_/"Min/Fee";

define _c3_/"Max/Fee";

Define Height/"Height";

rbreak after/summarize dul dol;

run;

Thanks&regards.

Sanjeev.K

Contributor
Posts: 70

Re: problem with RBREAK Statement in PROC report

Thanks Art and sidhu for quick reply ..

I tried with Sanjeev`s code, it`s meeting my requirement..Thanks sanjeev..

Thanks & Regards,

Yaswanth J.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 324 views
  • 0 likes
  • 6 in conversation