<?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: Unique count of frequencies proc tabulate in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863444#M341073</link>
    <description>Does it need to be PROC TABULATE? You could do this very easily with count distinct in PROC SQL</description>
    <pubDate>Fri, 10 Mar 2023 14:07:40 GMT</pubDate>
    <dc:creator>HarrySnart</dc:creator>
    <dc:date>2023-03-10T14:07:40Z</dc:date>
    <item>
      <title>Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863426#M341071</link>
      <description>&lt;P&gt;Hi experts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following dataset, where the same id could be present multiple time in combos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;id sales zone
1   2  "a"
1  3  "b"
1  5  "c"&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;There is any way to have proc tabulate compute distinct frequencies of "id" ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 13:16:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863426#M341071</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-03-10T13:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863444#M341073</link>
      <description>Does it need to be PROC TABULATE? You could do this very easily with count distinct in PROC SQL</description>
      <pubDate>Fri, 10 Mar 2023 14:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863444#M341073</guid>
      <dc:creator>HarrySnart</dc:creator>
      <dc:date>2023-03-10T14:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863459#M341078</link>
      <description>&lt;P&gt;Hi Harry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I simplified the tabulate code, but it does other other summarization. So yes, I need it in proc tabulate&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 14:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863459#M341078</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-03-10T14:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863472#M341085</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/71355"&gt;@dcortell&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Harry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I simplified the tabulate code, but it does other other summarization. So yes, I need it in proc tabulate&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show your code.&lt;/P&gt;
&lt;P&gt;I ask to see your code because if you want this value in an existing report table then the structure of the remaining code is needed to prevent things like crossing variables incorrectly.&lt;/P&gt;
&lt;P&gt;Second, what do you actually expect for out? I am afraid that "unique count of frequencies" may have more than one interpretation. Plus when your example data only shows one value for ID there isn't much clarity about what you are using for input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that you just need an N statistic in the right place, but do need the rest of your code.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 16:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863472#M341085</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-10T16:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863498#M341088</link>
      <description>&lt;P&gt;Sample dataset&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;id_brand&lt;/TD&gt;&lt;TD&gt;sales&lt;/TD&gt;&lt;TD&gt;zone&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample code (metacode)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=data;
   class
   id_brand zone;
   var sales;
   table zone,

   sales*sum
   id_brand*N="unique ids" (need unique N of ids) /rts=50
             ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm trying to understand if there is a N distinct approach to use in proc tabulate&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 17:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863498#M341088</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-03-10T17:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863500#M341089</link>
      <description>&lt;P&gt;Still don't see how you define "unique count". With the table that you show do you mean that "unique" count should be within each Zone? Or overall in the data?&lt;/P&gt;
&lt;P&gt;I think that you need to add a variable to you data set that is likely numeric that is assigned a value of one for only one record of each each id and then sum that. But where/how it appears in the table makes a difference on how that variable is made.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note, 3 records, especially without an example of how you want the result to appear is pretty slim to work with.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 17:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863500#M341089</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-10T17:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unique count of frequencies proc tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863761#M341170</link>
      <description>&lt;P&gt;Hi Ballard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, it was in the end how to I managed the unique count, adding a "1" flag for each unique combination of zone. I was hoping there was some "distinct" statement available in proc tabulate for unique frequencies, but it seems that the way to go is to manipulate the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 11:34:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unique-count-of-frequencies-proc-tabulate/m-p/863761#M341170</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-03-13T11:34:22Z</dc:date>
    </item>
  </channel>
</rss>

