<?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: Reporting summarised data with Proc Tabulate in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751625#M80741</link>
    <description>&lt;P&gt;Your constraints are unclear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you run proc tabulate twice? Once with statistics N and option OUT=, to check the underlying data, and then for the report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc report is typically more flexible than proc tabulate, not less.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jul 2021 06:40:14 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-07-02T06:40:14Z</dc:date>
    <item>
      <title>Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/186449#M47344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I often find that I'm drawing on the formatting features of Proc Tabulate to neatly present data which have already been summarised. That is, I just want to report single values in the table cells rather than summary statistics like the mean. I can, of course, do this by just presenting the mean (or the min, or the max etc) of the value. However, I would like to be able to double-check that I do indeed only have one value in the cell. Any suggestions on how to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More concretely, consider the following program which tabulates average income by sex and age. The first table works fine as a way to present these data. I'm using 'min' not because I want the minimum, but simply to report the (single) cell value. In the second table, I've introduced a mistake. I'm only tabulating by age, but there are two records in every cell in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I would like would be some way to flag that the second table is not valid for my data. A crude way is to tabulate the N function for each cell and check this for all 1 s - but this produces an additional ugly table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideally I would like to do with an 'only' function. This would return a missing value if the values in the cell had a positive variance (or range), and would return the mean (or min or max) if the variance was zero. I don't think this is possible in SAS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions? Or should I use some totally different approach to tabulating already summarised data. Proc report is naturally oriented towards listing cases, but my understanding is that it doesn't have the flexibility of tabulate for rearranging row and columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;input sex $ age $ avg_income;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;M Y 100&lt;/P&gt;&lt;P&gt;M O 210&lt;/P&gt;&lt;P&gt;F Y 66&lt;/P&gt;&lt;P&gt;F O 33&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc tabulate data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class sex age;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var income;&lt;/P&gt;&lt;P&gt;&amp;nbsp; table min=""*avg_income*sex,age;&lt;/P&gt;&lt;P&gt;&amp;nbsp; table min=""*avg_income*age;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 07:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/186449#M47344</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2014-10-16T07:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/750755#M80721</link>
      <description>&lt;P&gt;Bumping this. It's 7 years later and I would still like to be able to do this! Any progress on using custom functions in proc tabulate?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 08:25:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/750755#M80721</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2021-06-28T08:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751625#M80741</link>
      <description>&lt;P&gt;Your constraints are unclear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you run proc tabulate twice? Once with statistics N and option OUT=, to check the underlying data, and then for the report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc report is typically more flexible than proc tabulate, not less.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 06:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751625#M80741</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-02T06:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751632#M80743</link>
      <description>&lt;P&gt;Doesn't always work for data structure I'm using. Eg often I will have a table where some cells are constants (and I'd like to double-check this) while others are variable and I want to calculate the mean. It would be neat if I could write a cell function for this.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 07:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751632#M80743</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2021-07-02T07:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751634#M80744</link>
      <description>&lt;P&gt;what would the cell display?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 07:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751634#M80744</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-02T07:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751637#M80745</link>
      <description>&lt;P&gt;One way to summarise: If the variance is positive, show missing, if the variance is zero, show the mean (or the first, last - all the same).&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 07:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751637#M80745</guid>
      <dc:creator>BruceBrad</dc:creator>
      <dc:date>2021-07-02T07:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Reporting summarised data with Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751846#M80746</link>
      <description>&lt;P&gt;The only way is to pre-summarise and then set the values in a data step using the logic you describe.&lt;/P&gt;
&lt;P&gt;Then you display them as you do now.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Jul 2021 02:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reporting-summarised-data-with-Proc-Tabulate/m-p/751846#M80746</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-03T02:30:40Z</dc:date>
    </item>
  </channel>
</rss>

