<?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: restricting the statistics in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/restricting-the-statistics/m-p/35412#M5119</link>
    <description>Hi:&lt;BR /&gt;
  Look at and run the program below. Proc TABULATE is a summary procedure. If you have only one observation something uniquely identified by X, Y, Z values, then you should get the one row from TABULATE. However, Proc TABULATE's main purpose in life is to be a SUMMARY procedure and produce SUMMARY tables. So the default statistic associated with any numeric variable is the SUM statistic.&lt;BR /&gt;
&lt;BR /&gt;
  Depending on what you want to do, you may prefer output from PROC PRINT or PROC REPORT.&lt;BR /&gt;
&lt;BR /&gt;
  I'm not sure how you're getting numbers from TABULATE, when I run your program, I get the following error message:&lt;BR /&gt;
[pre]&lt;BR /&gt;
504    table x, y*(z,w);&lt;BR /&gt;
                    -&lt;BR /&gt;
                    22&lt;BR /&gt;
                    200&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, ), *,&lt;BR /&gt;
              -, :, &amp;lt;, =, [, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {.&lt;BR /&gt;
ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;
505  run;&lt;BR /&gt;
                          &lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE TABULATE used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
            &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Both Proc PRINT and Proc REPORT will essentially provide you with a "detail" report, where every report row represents one observation in the data. For example, SASHELP.CLASS has 19 observations, one for each of 19 students. In my program, I create a data set called SAMPLE from SASHELP.CLASS and I create 21 observations -- an extra one for Alfred and an extra one for Janet. You can see, if you review the program output, that PROC PRINT and PROC REPORT show 2 rows for Alfred and 2 rows for Janet. But, PROC TABULATE creates just one report row for each of these students (and summarizes their values for W).&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data sample;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
                                    &lt;BR /&gt;
  x = sex;&lt;BR /&gt;
  z = name;&lt;BR /&gt;
  if height gt 59 then y = 'XXX';&lt;BR /&gt;
     else y = 'YYY';&lt;BR /&gt;
  w = age;&lt;BR /&gt;
  output;&lt;BR /&gt;
                                      &lt;BR /&gt;
  ** create some extra obs to see diff between TAB and REPORT;&lt;BR /&gt;
  if name = 'Alfred' then output;&lt;BR /&gt;
     else if name = 'Janet' then output;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
proc sort data=sample out=sample;&lt;BR /&gt;
  by x y z w;&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
ods html file='c:\temp\sample.html' style=sasweb;&lt;BR /&gt;
proc print data=sample;&lt;BR /&gt;
  title 'Look at DATA';&lt;BR /&gt;
  title2 'Alfred and Janet each have 2 rows';&lt;BR /&gt;
  var x y z w;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
proc tabulate data=sample f=comma5.;&lt;BR /&gt;
  title 'Proc TABULATE';&lt;BR /&gt;
  title2 'With Tabulate, Alfred will have a value of 28 for W and Janet will have a value of 30';&lt;BR /&gt;
  class x y z;&lt;BR /&gt;
  var w;&lt;BR /&gt;
  table x, y*z ,w;&lt;BR /&gt;
  keylabel sum = ' ';&lt;BR /&gt;
run;&lt;BR /&gt;
                                 &lt;BR /&gt;
proc report data=sample nowd;&lt;BR /&gt;
  title 'Proc REPORT';&lt;BR /&gt;
  title2 'With Proc REPORT, Alfred will have 2 rows of detail data and Janet will have 2 rows of detail data';&lt;BR /&gt;
  column x y z w;&lt;BR /&gt;
  define x / order;&lt;BR /&gt;
  define y / order;&lt;BR /&gt;
  define z / order;&lt;BR /&gt;
  define w / display;&lt;BR /&gt;
  break after x / page;&lt;BR /&gt;
run;&lt;BR /&gt;
                         &lt;BR /&gt;
proc tabulate data=sample;&lt;BR /&gt;
  title 'Original Program - gets error message';&lt;BR /&gt;
  class x y z;&lt;BR /&gt;
  var w;&lt;BR /&gt;
  table x, y*(z,w);&lt;BR /&gt;
run; &lt;BR /&gt;
                 &lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 31 Jul 2008 19:29:40 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2008-07-31T19:29:40Z</dc:date>
    <item>
      <title>restricting the statistics</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/restricting-the-statistics/m-p/35411#M5118</link>
      <description>Hi&lt;BR /&gt;
I dont want to use any statistic to numeric variable which I am using in the var statement of proc tabulate, is it possible?&lt;BR /&gt;
e.g&lt;BR /&gt;
proc tabulate data=sample;&lt;BR /&gt;
 class x y z;&lt;BR /&gt;
  var w;&lt;BR /&gt;
  table x, y*(z,w);&lt;BR /&gt;
run;&lt;BR /&gt;
here I am getting sum of the values for the variable w, but I dont the sum. I just want to display the value of the variable W as it is.&lt;BR /&gt;
please help me</description>
      <pubDate>Thu, 31 Jul 2008 13:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/restricting-the-statistics/m-p/35411#M5118</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-31T13:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: restricting the statistics</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/restricting-the-statistics/m-p/35412#M5119</link>
      <description>Hi:&lt;BR /&gt;
  Look at and run the program below. Proc TABULATE is a summary procedure. If you have only one observation something uniquely identified by X, Y, Z values, then you should get the one row from TABULATE. However, Proc TABULATE's main purpose in life is to be a SUMMARY procedure and produce SUMMARY tables. So the default statistic associated with any numeric variable is the SUM statistic.&lt;BR /&gt;
&lt;BR /&gt;
  Depending on what you want to do, you may prefer output from PROC PRINT or PROC REPORT.&lt;BR /&gt;
&lt;BR /&gt;
  I'm not sure how you're getting numbers from TABULATE, when I run your program, I get the following error message:&lt;BR /&gt;
[pre]&lt;BR /&gt;
504    table x, y*(z,w);&lt;BR /&gt;
                    -&lt;BR /&gt;
                    22&lt;BR /&gt;
                    200&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, ), *,&lt;BR /&gt;
              -, :, &amp;lt;, =, [, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {.&lt;BR /&gt;
ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;
505  run;&lt;BR /&gt;
                          &lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE TABULATE used (Total process time):&lt;BR /&gt;
      real time           0.01 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
&lt;BR /&gt;
            &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Both Proc PRINT and Proc REPORT will essentially provide you with a "detail" report, where every report row represents one observation in the data. For example, SASHELP.CLASS has 19 observations, one for each of 19 students. In my program, I create a data set called SAMPLE from SASHELP.CLASS and I create 21 observations -- an extra one for Alfred and an extra one for Janet. You can see, if you review the program output, that PROC PRINT and PROC REPORT show 2 rows for Alfred and 2 rows for Janet. But, PROC TABULATE creates just one report row for each of these students (and summarizes their values for W).&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data sample;&lt;BR /&gt;
  set sashelp.class;&lt;BR /&gt;
                                    &lt;BR /&gt;
  x = sex;&lt;BR /&gt;
  z = name;&lt;BR /&gt;
  if height gt 59 then y = 'XXX';&lt;BR /&gt;
     else y = 'YYY';&lt;BR /&gt;
  w = age;&lt;BR /&gt;
  output;&lt;BR /&gt;
                                      &lt;BR /&gt;
  ** create some extra obs to see diff between TAB and REPORT;&lt;BR /&gt;
  if name = 'Alfred' then output;&lt;BR /&gt;
     else if name = 'Janet' then output;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
proc sort data=sample out=sample;&lt;BR /&gt;
  by x y z w;&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
ods html file='c:\temp\sample.html' style=sasweb;&lt;BR /&gt;
proc print data=sample;&lt;BR /&gt;
  title 'Look at DATA';&lt;BR /&gt;
  title2 'Alfred and Janet each have 2 rows';&lt;BR /&gt;
  var x y z w;&lt;BR /&gt;
run;&lt;BR /&gt;
                      &lt;BR /&gt;
proc tabulate data=sample f=comma5.;&lt;BR /&gt;
  title 'Proc TABULATE';&lt;BR /&gt;
  title2 'With Tabulate, Alfred will have a value of 28 for W and Janet will have a value of 30';&lt;BR /&gt;
  class x y z;&lt;BR /&gt;
  var w;&lt;BR /&gt;
  table x, y*z ,w;&lt;BR /&gt;
  keylabel sum = ' ';&lt;BR /&gt;
run;&lt;BR /&gt;
                                 &lt;BR /&gt;
proc report data=sample nowd;&lt;BR /&gt;
  title 'Proc REPORT';&lt;BR /&gt;
  title2 'With Proc REPORT, Alfred will have 2 rows of detail data and Janet will have 2 rows of detail data';&lt;BR /&gt;
  column x y z w;&lt;BR /&gt;
  define x / order;&lt;BR /&gt;
  define y / order;&lt;BR /&gt;
  define z / order;&lt;BR /&gt;
  define w / display;&lt;BR /&gt;
  break after x / page;&lt;BR /&gt;
run;&lt;BR /&gt;
                         &lt;BR /&gt;
proc tabulate data=sample;&lt;BR /&gt;
  title 'Original Program - gets error message';&lt;BR /&gt;
  class x y z;&lt;BR /&gt;
  var w;&lt;BR /&gt;
  table x, y*(z,w);&lt;BR /&gt;
run; &lt;BR /&gt;
                 &lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 31 Jul 2008 19:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/restricting-the-statistics/m-p/35412#M5119</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-07-31T19:29:40Z</dc:date>
    </item>
  </channel>
</rss>

