<?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: Counting unique products for a list of members in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Counting-unique-products-for-a-list-of-members/m-p/433693#M107548</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (member_id sold_dt product) (:$20.);
datalines;
1  xx/xx/xxxx a
1  xx/xx/xxxx b
1  xx/xx/xxxx b
1  xx/xx/xxxx c
2 xx/xx/xxxx a
2 xx/xx/xxxx a
2 xx/xx/xxxx a
2 xx/xx/xxxx b
;

proc sql;
create table want as
select member_id, count(distinct product) as count
from have
group by member_id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Feb 2018 20:36:47 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-02-02T20:36:47Z</dc:date>
    <item>
      <title>Counting unique products for a list of members</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-unique-products-for-a-list-of-members/m-p/433689#M107547</link>
      <description>&lt;P&gt;Hello.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that has the following set up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;member_id sold_dt product&lt;/P&gt;&lt;P&gt;1&amp;nbsp; xx/xx/xxxx a&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; xx/xx/xxxx&amp;nbsp;b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; xx/xx/xxxx&amp;nbsp;b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1&amp;nbsp; xx/xx/xxxx&amp;nbsp;c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2 xx/xx/xxxx a&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 xx/xx/xxxx a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 xx/xx/xxxx a&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 xx/xx/xxxx&amp;nbsp;b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I want to do is end up with a dataset with the following set up:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;member_id product_cnt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want a count of the unique products.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 20:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-unique-products-for-a-list-of-members/m-p/433689#M107547</guid>
      <dc:creator>JDonovan</dc:creator>
      <dc:date>2018-02-02T20:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Counting unique products for a list of members</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Counting-unique-products-for-a-list-of-members/m-p/433693#M107548</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (member_id sold_dt product) (:$20.);
datalines;
1  xx/xx/xxxx a
1  xx/xx/xxxx b
1  xx/xx/xxxx b
1  xx/xx/xxxx c
2 xx/xx/xxxx a
2 xx/xx/xxxx a
2 xx/xx/xxxx a
2 xx/xx/xxxx b
;

proc sql;
create table want as
select member_id, count(distinct product) as count
from have
group by member_id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 20:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Counting-unique-products-for-a-list-of-members/m-p/433693#M107548</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-02T20:36:47Z</dc:date>
    </item>
  </channel>
</rss>

