turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- problem with RBREAK Statement in PROC report

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-20-2013 05:19 AM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-28-2013 05:26 AM

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®ards.

Sanjeev.K

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-20-2013 05:35 AM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to damanaulakh88

02-20-2013 05:46 AM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-20-2013 01:33 PM

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...**

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Cynthia_sas

02-27-2013 04:51 AM

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.

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

Please help..

Thanks,

Yaswanth J

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-27-2013 11:29 AM

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;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-28-2013 02:13 AM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-28-2013 05:26 AM

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®ards.

Sanjeev.K

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to yaswanthj

02-28-2013 05:47 AM

Thanks Art and sidhu for quick reply ..

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

Thanks & Regards,

Yaswanth J.