BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yaswanthj
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
kuridisanjeev
Quartz | Level 8

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

8 REPLIES 8
damanaulakh88
Obsidian | Level 7

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

yaswanthj
Calcite | Level 5

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

Cynthia_sas
SAS Super FREQ

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

yaswanthj
Calcite | Level 5

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

Sidhu
Calcite | Level 5

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;

ArtC
Rhodochrosite | Level 12

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;

kuridisanjeev
Quartz | Level 8

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

yaswanthj
Calcite | Level 5

Thanks Art and sidhu for quick reply ..

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

Thanks & Regards,

Yaswanth J.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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