<?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: Multiple Statistics in proc report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69761#M8011</link>
    <description>Or maybe you will like 'line' statement.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data shoes;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  by region;&lt;BR /&gt;
  where region in ('Asia', 'Canada', 'Pacific');&lt;BR /&gt;
  run; &lt;BR /&gt;
                     &lt;BR /&gt;
ods html file='c:\temp\compare.html' style=sasweb;&lt;BR /&gt;
proc report data=shoes nowd ;&lt;BR /&gt;
title 'REPORT approach';&lt;BR /&gt;
column region product sales  sales=mean_sales sales=median_sales;&lt;BR /&gt;
define region / group ;&lt;BR /&gt;
define product / order ;&lt;BR /&gt;
define sales / display 'Sales';&lt;BR /&gt;
define mean_sales/analysis mean noprint;&lt;BR /&gt;
define median_sales/analysis median noprint;&lt;BR /&gt;
                        &lt;BR /&gt;
compute after region / style={font_weight=bold};&lt;BR /&gt;
  line 'Mean :' @20 mean_sales dollar18.;&lt;BR /&gt;
  line 'Median:' @20 median_sales dollar18.;&lt;BR /&gt;
endcomp;                    &lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Mon, 21 Feb 2011 09:39:32 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-02-21T09:39:32Z</dc:date>
    <item>
      <title>Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69756#M8006</link>
      <description>Hello I want to create a report in this form:&lt;BR /&gt;
              People     GDP       &lt;BR /&gt;
Russia    &lt;BR /&gt;
India&lt;BR /&gt;
China&lt;BR /&gt;
USA&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Mean &lt;BR /&gt;
Median&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
I have about 10 different variables like people and GDP and I need mean and median for each after the observations have been listed. In case you are familiar with this document, I can use the sample code shown in &lt;A href="http://www2.sas.com/proceedings/sugi30/259-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/259-30.pdf&lt;/A&gt;. But using the method there would mean creating 20 different country variables, 20 new  mean and median variables and then writing the compute function 20 times. There has to be simpler way! Can somebody please tell me how to create this simple report given the data points for each country?&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much!&lt;BR /&gt;
Sid</description>
      <pubDate>Mon, 07 Feb 2011 08:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69756#M8006</guid>
      <dc:creator>SidS</dc:creator>
      <dc:date>2011-02-07T08:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69757#M8007</link>
      <description>Sid&lt;BR /&gt;
how many rows in your input?, &lt;BR /&gt;
How many columns? &lt;BR /&gt;
Is PROC REPORT the only solution you will accept? (if so, then why?)&lt;BR /&gt;
Where do you want results (text, table, html, excel, pdf) ?&lt;BR /&gt;
hth&lt;BR /&gt;
peterC</description>
      <pubDate>Mon, 07 Feb 2011 10:24:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69757#M8007</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-02-07T10:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69758#M8008</link>
      <description>Hi:&lt;BR /&gt;
  As Peter suggests, other procedures  (such as PROC TABULATE) may be better suited to your report, however, there is a second method to get more extra summary lines at the bottom of a PROC REPORT break group. &lt;BR /&gt;
 &lt;BR /&gt;
  For example, take a look at SASHELP.SHOES. If I wanted to create this report (shown only for Asia):&lt;BR /&gt;
[pre]&lt;BR /&gt;
  Region                     Product            Inventory         Sales       Returns&lt;BR /&gt;
  Asia                       Boot                  $9,576        $1,996           $80&lt;BR /&gt;
                             Men's Dress          $20,831        $3,033           $52&lt;BR /&gt;
                             Sandal               $15,087        $3,230          $120&lt;BR /&gt;
                             Slipper              $16,075        $3,019          $127&lt;BR /&gt;
                             Women's Casual       $16,251        $5,389          $185&lt;BR /&gt;
                             Boot                $160,589       $60,712        $1,296&lt;BR /&gt;
                             Men's Casual          $2,176       $11,754          $833&lt;BR /&gt;
                             Men's Dress         $251,803      $116,333        $2,443&lt;BR /&gt;
                             Sandal               $21,483        $4,978          $105&lt;BR /&gt;
                             Slipper             $469,007      $149,013        $2,941&lt;BR /&gt;
                             Sport Shoe              $455          $937           $10&lt;BR /&gt;
                             Women's Casual       $36,576       $20,448          $790&lt;BR /&gt;
                             Women's Dress       $140,628       $78,234        $1,891&lt;BR /&gt;
                             Sport Shoe           $15,602        $1,155           $22&lt;BR /&gt;
  Sum                                          $1,176,139      $460,231       $10,895&lt;BR /&gt;
  Mean                                            $84,010       $32,874          $778&lt;BR /&gt;
  Median                                          $18,541        $5,184          $156&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                         &lt;BR /&gt;
I would need to create 2 "extra" break variables and only have 2 more COMPUTE blocks added to my PROC REPORT code -- and the Mean and Median break lines would get automatically added for every unique value of region (as long as I created by 2 "extra" break variables correctly.&lt;BR /&gt;
 &lt;BR /&gt;
Is this report close to what you had in mind???&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Mon, 07 Feb 2011 16:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69758#M8008</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-07T16:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69759#M8009</link>
      <description>Peter,&lt;BR /&gt;
   I do not need to use proc report. If there is an easier way, please let me know as I am still learning SAS. Preferably, I would like the output to be in latex. But that seems to bring about a whole bunch of other problems, so I will be happy with a csv or xls output for now. I have about 150 rows.&lt;BR /&gt;
&lt;BR /&gt;
Cynthia,&lt;BR /&gt;
   Yes I need the output just like your report. I actually have groups by continent as well which I forgot to mention. How did you create it?&lt;BR /&gt;
&lt;BR /&gt;
When is proc tabulate preferable to proc report?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Sid</description>
      <pubDate>Mon, 07 Feb 2011 22:27:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69759#M8009</guid>
      <dc:creator>SidS</dc:creator>
      <dc:date>2011-02-07T22:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69760#M8010</link>
      <description>Hi:&lt;BR /&gt;
  I created my report with PROC REPORT. I could also have used TABULATE. The difference between REPORT and TABULATE is going to come down to how comfortable you are with the syntax of each.&lt;BR /&gt;
&lt;BR /&gt;
  REPORT is more verbose and takes more statements to achieve the same thing that TABULATE can do in a very elegant and almost algebraic syntax. On the other hand, TABULATE cannot skip lines between groups and TABULATE does not have the COMPUTE block. REPORT has the NOPRINT option (which allows you to hide columns, but still use them on the REPORT -- which is what I needed for this report). REPORT also has aliasing techniques -- which allows you to use the same variable multiple times to get different statistics.&lt;BR /&gt;
 &lt;BR /&gt;
  So, you decide. The code to create the table with PROC TABULATE is first, followed the the code for PROC REPORT. The ODS statements use a variety of styles for a variety of destinations. I have no way of knowing what the LaTeX output will look like because I don't exactly know how to compile or look at a LaTeX file -- I only know that I can create it with ODS.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
** Make "fake" variables for PROC REPORT;&lt;BR /&gt;
** also subset data with WHERE statement;&lt;BR /&gt;
** TABULATE will use the subset of data;&lt;BR /&gt;
** REPORT needs the extra variables -- to be unique and the same for each region;&lt;BR /&gt;
data shoes;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  by region;&lt;BR /&gt;
  where region in ('Asia', 'Canada', 'Pacific');&lt;BR /&gt;
  retain regcntr;&lt;BR /&gt;
  if first.region then regcntr +1;&lt;BR /&gt;
  othrcntr = regcntr*100;&lt;BR /&gt;
  run; &lt;BR /&gt;
                     &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods csvall file='c:\temp\compare.csv';&lt;BR /&gt;
ods pdf file='c:\temp\compare.pdf';&lt;BR /&gt;
ods rtf file='c:\temp\compare.rtf' style=journal;&lt;BR /&gt;
ods tagsets.excelxp file='c:\temp\compare_xp.xls' style=sasweb;&lt;BR /&gt;
ods html file='c:\temp\compare.html' style=sasweb;&lt;BR /&gt;
ods latex file='c:\temp\compare.tex' style=printer;&lt;BR /&gt;
                           &lt;BR /&gt;
proc tabulate data=shoes f=comma14.2;&lt;BR /&gt;
  title 'TABULATE approach';&lt;BR /&gt;
  class region product;&lt;BR /&gt;
  var inventory sales returns;&lt;BR /&gt;
  table (region * (product all*{s={font_weight=bold}}  mean*{s={font_weight=bold}} median*{s={font_weight=bold}})),&lt;BR /&gt;
        inventory sales returns &lt;BR /&gt;
        / row=float;&lt;BR /&gt;
  keylabel sum=' '&lt;BR /&gt;
           all='Sum';&lt;BR /&gt;
run;&lt;BR /&gt;
                          &lt;BR /&gt;
               &lt;BR /&gt;
proc report data=shoes nowd&lt;BR /&gt;
     style(summary)=Header;&lt;BR /&gt;
title 'REPORT approach';&lt;BR /&gt;
column othrcntr regcntr region product inventory sales returns &lt;BR /&gt;
       inventory=imed sales=smed returns=rmed  &lt;BR /&gt;
       inventory=iavg sales=savg returns=ravg ;&lt;BR /&gt;
define othrcntr / group noprint;&lt;BR /&gt;
define regcntr /group noprint;&lt;BR /&gt;
define region / group style(column)=Header;&lt;BR /&gt;
define product / group style(column)=Header;&lt;BR /&gt;
define inventory/ sum 'Inventory';&lt;BR /&gt;
define sales / sum 'Sales';&lt;BR /&gt;
define returns / sum 'Returns';&lt;BR /&gt;
                           &lt;BR /&gt;
define imed/ median 'Median Inv' noprint;&lt;BR /&gt;
define smed / median 'Median Sales' noprint;&lt;BR /&gt;
define rmed / median 'Median Ret' noprint;&lt;BR /&gt;
                   &lt;BR /&gt;
define iavg/ mean 'Avg Inv' noprint;&lt;BR /&gt;
define savg / mean 'Avg Sales' noprint;&lt;BR /&gt;
define ravg / mean 'Avg Ret' noprint;&lt;BR /&gt;
break after othrcntr / summarize;&lt;BR /&gt;
break after regcntr / summarize;&lt;BR /&gt;
break after region / summarize;&lt;BR /&gt;
                        &lt;BR /&gt;
compute after othrcntr;&lt;BR /&gt;
  region = 'Median';&lt;BR /&gt;
  inventory.sum = imed;&lt;BR /&gt;
  sales.sum = smed;&lt;BR /&gt;
  returns.sum = rmed;&lt;BR /&gt;
  line ' ';&lt;BR /&gt;
endcomp;&lt;BR /&gt;
compute after regcntr;&lt;BR /&gt;
  region = 'Mean';&lt;BR /&gt;
  inventory.sum = iavg;&lt;BR /&gt;
  sales.sum = savg;&lt;BR /&gt;
  returns.sum = ravg;&lt;BR /&gt;
endcomp;&lt;BR /&gt;
compute after region;&lt;BR /&gt;
  region = 'Sum';&lt;BR /&gt;
endcomp;&lt;BR /&gt;
                                      &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
ods _all_ close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 08 Feb 2011 01:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69760#M8010</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2011-02-08T01:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Statistics in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69761#M8011</link>
      <description>Or maybe you will like 'line' statement.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data shoes;&lt;BR /&gt;
  set sashelp.shoes;&lt;BR /&gt;
  by region;&lt;BR /&gt;
  where region in ('Asia', 'Canada', 'Pacific');&lt;BR /&gt;
  run; &lt;BR /&gt;
                     &lt;BR /&gt;
ods html file='c:\temp\compare.html' style=sasweb;&lt;BR /&gt;
proc report data=shoes nowd ;&lt;BR /&gt;
title 'REPORT approach';&lt;BR /&gt;
column region product sales  sales=mean_sales sales=median_sales;&lt;BR /&gt;
define region / group ;&lt;BR /&gt;
define product / order ;&lt;BR /&gt;
define sales / display 'Sales';&lt;BR /&gt;
define mean_sales/analysis mean noprint;&lt;BR /&gt;
define median_sales/analysis median noprint;&lt;BR /&gt;
                        &lt;BR /&gt;
compute after region / style={font_weight=bold};&lt;BR /&gt;
  line 'Mean :' @20 mean_sales dollar18.;&lt;BR /&gt;
  line 'Median:' @20 median_sales dollar18.;&lt;BR /&gt;
endcomp;                    &lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Mon, 21 Feb 2011 09:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Multiple-Statistics-in-proc-report/m-p/69761#M8011</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-21T09:39:32Z</dc:date>
    </item>
  </channel>
</rss>

