<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc report role of summarize after break variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452394#M69818</link>
    <description>&lt;P&gt;Thank you for the reply!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But for &lt;SPAN&gt;Hatchback and &lt;/SPAN&gt;Highway MPG for instance, 32.5 is not the average of 31.7, 32.2, and 36. Same as SUV and City MPG, SUV and Highway MPG, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, what does rbreak indicate? It doesn't have averages of all cars for each City MPG either.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Apr 2018 03:40:15 GMT</pubDate>
    <dc:creator>gsk</dc:creator>
    <dc:date>2018-04-09T03:40:15Z</dc:date>
    <item>
      <title>Proc report role of summarize after break variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452378#M69816</link>
      <description>&lt;P&gt;&lt;SPAN&gt;When I&amp;nbsp;put break or&amp;nbsp;&lt;/SPAN&gt;rbreak&lt;SPAN&gt;&amp;nbsp;after + some variable, sometimes proc report prints out&amp;nbsp;&lt;/SPAN&gt;sums&lt;SPAN&gt;, sometimes means or neither. If you find the attached for the output of the code below, the first highlighted value 25.2 seems to be the mean, but not other values. What are these numbers that proc report is showing as a summary?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SAS documentation just says that the "summarize" option shows a summary line...... What kind of summary line is&amp;nbsp;that showing though? There can be many,&amp;nbsp;including means, medians, and quartiles.......&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report nowd data=cars;&lt;/P&gt;&lt;P&gt;where upcase(country) in ('GERMANY','JAPAN','USA') and&lt;BR /&gt;upcase(type) in ('SUV','SEDAN','HATCHBACK');&lt;BR /&gt;&lt;BR /&gt;columns type country citympg hwympg ('Std Dev' citympg=citistd hwympg=hwystd);&lt;BR /&gt;&lt;BR /&gt;define country / group 'Country of Origin';&lt;BR /&gt;define type / group 'Type of Car';&lt;BR /&gt;define citympg / analysis mean 'City MPG' format=5.1;&lt;BR /&gt;define hwympg / analysis mean 'Highway MPG' format=5.1;&lt;BR /&gt;define citistd / analysis std 'City MPG Std' format=5.1;&lt;BR /&gt;define hwystd / analysis std 'Highway MPG std' format=5.1;&lt;BR /&gt;&lt;BR /&gt;break after type / summarize suppress DOL ul style=[BACKGROUNDCOLOR=ltgray];&lt;BR /&gt;/* break after cylinders/ summarize suppress ol ul; */&lt;BR /&gt;rbreak after / summarize ol ul;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc report.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19690i6D63C005A3E349F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc report.JPG" alt="proc report.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 22:58:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452378#M69816</guid>
      <dc:creator>gsk</dc:creator>
      <dc:date>2018-04-08T22:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report role of summarize after break variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452390#M69817</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; The statistic that is produced on a BREAK or RBREAK summary line depends on the statistic that you list in your DEFINE statement for the variable.&lt;BR /&gt;&lt;BR /&gt; For example, in your code, you have asked for MEAN for 2 of your variables and STD for the other 2 numeric variables. If you want SUM instead of MEAN or STD, you have to change the statistic listed. Without the name of a statistic, a numeric variable defaults to the SUM statistic. As soon as you use a statistic, then you get THAT statistic at the break.&lt;BR /&gt;&lt;BR /&gt;Cynthia (see the example below)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.cars
  style(summary) = Header;
  where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
  column type make wheelbase msrp mpg_highway mpg_city enginesize
         invoice horsepower weight length;
  define type / group;
  define make / group;
  define wheelbase / n 'N WheelBase';
  define msrp / mean 'Mean MSRP';
  define mpg_highway / sum 'SUM MPG HIGHWAY';
  define mpg_city / std 'STD MPG City';
  define enginesize / css 'CSS EngineSize';
  define invoice / median 'Median Invoice';
  define horsepower / stderr 'StdErr HorsePower'; 
  define weight / min 'Min Weight';
  define length / max 'Max Length';
  break after type / summarize;
  rbreak after / summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2018 00:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452390#M69817</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-04-09T00:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report role of summarize after break variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452394#M69818</link>
      <description>&lt;P&gt;Thank you for the reply!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But for &lt;SPAN&gt;Hatchback and &lt;/SPAN&gt;Highway MPG for instance, 32.5 is not the average of 31.7, 32.2, and 36. Same as SUV and City MPG, SUV and Highway MPG, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, what does rbreak indicate? It doesn't have averages of all cars for each City MPG either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 03:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452394#M69818</guid>
      <dc:creator>gsk</dc:creator>
      <dc:date>2018-04-09T03:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report role of summarize after break variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452498#M69826</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I did not use your data, but for SASHELP.CARS, when I double check my numbers from PROC REPORT against the same statistics with PROC MEANS, I get the same numbers, so for my data (and all the other test cases I use) PROC MEANS and PROC REPORT give me the same values. Do remember that PROC REPORT is showing the formatted numbers, which is why some rounding occurs:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="same_numbers_report_mean.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19699i1718C488CD645502/image-size/large?v=v2&amp;amp;px=999" role="button" title="same_numbers_report_mean.png" alt="same_numbers_report_mean.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Try the revised code below and you should get the same results in PROC MEANS for all the BREAK lines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; An RBREAK statement is the summary at the bottom (or top) of the report. It is the summary overall the entire report, if you are getting the SUM statistic, then it is what you might call a Grand Total. Only the statistic you get on the RBREAK line (in my case, at the bottom of the report) is the statistic requested for the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Since you did not provide any data, it is impossible to verify that PROC REPORT is generating incorrect numbers. However, remember that if you have grouped the items by your Country variables, so that each report row represents the AVERAGE for a country, that PROC REPORT is not averaging the averages -- it is taking the grand mean -- the sum of ALL the values divided by the TOTAL count of non-missing observations -- this will usually be different than the average of the averages, which is why you have to use a PROCEDURE like PROC MEANS to compare against. The best thing for you to do is either run a verification like mine, with PROC MEANS or open a track with Tech Support and send them ALL your data and ALL your code and see if they can explain why or how PROC REPORT is not generating the results you expect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;** Revised code that proves PROC REPORT is generating the same statistics as PROC MEANS;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.cars
  style(summary) = Header;
  where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
  column type make wheelbase msrp mpg_highway mpg_city enginesize
         invoice horsepower weight length;
  define type / group;
  define make / group;
  define wheelbase / n 'N WheelBase';
  define msrp / mean 'Mean MSRP';
  define mpg_highway / sum 'SUM MPG HIGHWAY';
  define mpg_city / std 'STD MPG City';
  define enginesize / css 'CSS EngineSize';
  define invoice / median 'Median Invoice';
  define horsepower / stderr 'StdErr HorsePower'; 
  define weight / min 'Min Weight';
  define length / max 'Max Length';
  break after type / summarize;
  rbreak after / summarize;
run;

** get same numbers with PROC MEANS as PROC REPORT;
proc means data=sashelp.cars n;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var wheelbase ; 
run;

proc means data=sashelp.cars mean;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var msrp ; 
run;

proc means data=sashelp.cars sum;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var mpg_highway ; 
run;

proc means data=sashelp.cars std;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var mpg_city ; 
run;

proc means data=sashelp.cars css;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var enginesize ; 
run;

proc means data=sashelp.cars median;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var invoice ; 
run;

proc means data=sashelp.cars stderr;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var horsepower ; 
run;

proc means data=sashelp.cars min;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var weight ; 
run;

proc means data=sashelp.cars max;
   where make in ('Honda' 'Toyota' 'BMW' 'Cadillac');
   class type ;
  var length ; 
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 14:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452498#M69826</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-04-09T14:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report role of summarize after break variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452517#M69827</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172057"&gt;@gsk&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the reply!&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But for &lt;SPAN&gt;Hatchback and &lt;/SPAN&gt;Highway MPG for instance, 32.5 is not the average of 31.7, 32.2, and 36. Same as SUV and City MPG, SUV and Highway MPG, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, what does rbreak indicate? It doesn't have averages of all cars for each City MPG either.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You need to look at how many models fall into each category. Suppose the country with the 32.2 average has 6 models but the others only one each the overall mean is different as the divisor is different.&lt;/P&gt;
&lt;PRE&gt;data example;
   simplemean= mean(31.7,32.2,36); /* and almost certainly incorrect unless each country has exactly one model*/
   meanwithcounts = mean (31.7, 32.2,32.2,32.2,32.2,32.2,32.2, 36);
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2018 15:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-role-of-summarize-after-break-variable/m-p/452517#M69827</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-09T15:05:40Z</dc:date>
    </item>
  </channel>
</rss>

