<?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 Count the number of individuals with the same characteristics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427522#M105457</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use Proc SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran (164).png" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17835iC4934477DC673A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran (164).png" alt="Capture d’écran (164).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;An individual with the same characteristics is the same person&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to count the number of individuals with same characteristics, and get this table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name&amp;nbsp; &amp;nbsp;C1 C2 C3 Count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas 1 2 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;Thomas 3 4 3&amp;nbsp;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Thomas 1 2 5&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;Fabien 1 2 3&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/SPAN&gt;&lt;BR /&gt;Fabien 7 8 9&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;An individual with not the same characteristics, is not the same person, so we have 3 thomas and 2 fabien.&lt;/P&gt;&lt;P&gt;But the first thomas was recorded&amp;nbsp;3times, and&amp;nbsp;&amp;nbsp;the first fabien 2 times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Jan 2018 16:49:40 GMT</pubDate>
    <dc:creator>WilliamB</dc:creator>
    <dc:date>2018-01-14T16:49:40Z</dc:date>
    <item>
      <title>Count the number of individuals with the same characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427522#M105457</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use Proc SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a SAS table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran (164).png" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17835iC4934477DC673A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran (164).png" alt="Capture d’écran (164).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;An individual with the same characteristics is the same person&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to count the number of individuals with same characteristics, and get this table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Name&amp;nbsp; &amp;nbsp;C1 C2 C3 Count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thomas 1 2 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;Thomas 3 4 3&amp;nbsp;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Thomas 1 2 5&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;Fabien 1 2 3&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/SPAN&gt;&lt;BR /&gt;Fabien 7 8 9&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;An individual with not the same characteristics, is not the same person, so we have 3 thomas and 2 fabien.&lt;/P&gt;&lt;P&gt;But the first thomas was recorded&amp;nbsp;3times, and&amp;nbsp;&amp;nbsp;the first fabien 2 times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2018 16:49:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427522#M105457</guid>
      <dc:creator>WilliamB</dc:creator>
      <dc:date>2018-01-14T16:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of individuals with the same characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427524#M105459</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select *,count(*) as Count from have&lt;/P&gt;
&lt;P&gt;group by name, c1,c2,c3;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2018 17:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427524#M105459</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2018-01-14T17:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of individuals with the same characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427537#M105467</link>
      <description>&lt;P&gt;Try a basic PROC FREQ, TABULATE, MEANS/SUMMARY/UNIVARIATE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have noprint;

table name*c1*c2*c3 / list out=want;

run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/112281"&gt;@WilliamB&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to use Proc SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS table:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran (164).png" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17835iC4934477DC673A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran (164).png" alt="Capture d’écran (164).png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;An individual with the same characteristics is the same person&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to count the number of individuals with same characteristics, and get this table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Name&amp;nbsp; &amp;nbsp;C1 C2 C3 Count&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thomas 1 2 3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;Thomas 3 4 3&amp;nbsp;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;Thomas 1 2 5&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;BR /&gt;Fabien 1 2 3&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/SPAN&gt;&lt;BR /&gt;Fabien 7 8 9&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;An individual with not the same characteristics, is not the same person, so we have 3 thomas and 2 fabien.&lt;/P&gt;
&lt;P&gt;But the first thomas was recorded&amp;nbsp;3times, and&amp;nbsp;&amp;nbsp;the first fabien 2 times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2018 18:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427537#M105467</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-14T18:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of individuals with the same characteristics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427549#M105469</link>
      <description>&lt;P&gt;If your data is a representative sample of your real,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s suggestion is prolly the &lt;STRONG&gt;best&lt;/STRONG&gt; and &lt;STRONG&gt;neat&lt;/STRONG&gt;. SQl will remerge. Reemerge is fancy word for a 2nd pass. However, it's up to you. A bit more fun on a sunny sunday afternoon from me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Name   C1 C2 C3) ($);
datalines;
Thomas 1 2 3          3
Thomas 3 4 3           1
Thomas 1 2 5          1
Fabien 1 2 3          2
Fabien 7 8 9          1
Thomas 1 2 3          3
Thomas 1 2 5          1
;

data _null_;
  if _N_ = 1 then do;
  if 0 then set have;
     declare hash h( );
      h.defineKey('Name','C1','C2','C3');
      h.defineData('Name','C1','C2','C3','count');
      h.defineDone();
	 end;
set have end=last;
if h.check() ne 0 then do;count=0;count+1;h.add();end;
else if h.find()=0 then do;count+1;h.replace();end;
if last then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Jan 2018 19:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-the-number-of-individuals-with-the-same-characteristics/m-p/427549#M105469</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-14T19:54:14Z</dc:date>
    </item>
  </channel>
</rss>

