<?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: Count unique variables associated with one firm in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400443#M20876</link>
    <description>&lt;P&gt;Thank you. I now used a proc freq as follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=sortedibes noprint order=freq;&lt;BR /&gt;tables CUSIP*ANALYS*FPEDATS /out=counts;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means data=counts max;&lt;BR /&gt;class CUSIP ANALYS;&lt;BR /&gt;var COUNT;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get the&amp;nbsp;total value for unique ANALYS for a particular cusip on a particular date with is FPEDATS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2017 20:12:52 GMT</pubDate>
    <dc:creator>dlazer1</dc:creator>
    <dc:date>2017-10-02T20:12:52Z</dc:date>
    <item>
      <title>Count unique variables associated with one firm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400084#M20855</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have my data set and need to do a count for unique analysts following a company. They are given random numbers but all I need is a final count.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have this but it is not working.&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data=rawdata.ibes noprint;&lt;BR /&gt;count=1 if analys="";&lt;BR /&gt;var count;&lt;BR /&gt;by cusip fpedats;&lt;BR /&gt;output out=forecastdate sum(count)=total;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 05:46:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400084#M20855</guid>
      <dc:creator>dlazer1</dc:creator>
      <dc:date>2017-10-01T05:46:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique variables associated with one firm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400098#M20857</link>
      <description>&lt;P&gt;The following might help you find an answer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Count the distinct values of a variable"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/36/898.html" target="_blank"&gt;http://support.sas.com/kb/36/898.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 08:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400098#M20857</guid>
      <dc:creator>Norman21</dc:creator>
      <dc:date>2017-10-01T08:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique variables associated with one firm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400143#M20860</link>
      <description>&lt;P&gt;There are two methods illustrated here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*This demonstrates how to count the number of unique occurences of a variable
across groups. It uses the SASHELP.CARS dataset which is available with any SAS installation.
The objective is to determine the number of unique car makers by origin/

Note: The SQL solution can be off if you have a large data set and these are not the only two ways to calculate distinct counts.
If you're dealing with a large data set other methods may be appropriate.*/

*Count distinct IDs;
proc sql;
create table distinct_sql as
select origin, count(distinct make) as n_make
from sashelp.cars
group by origin;
quit;

*Double PROC FREQ;
proc freq data=sashelp.cars noprint;
table origin * make / out=origin_make;
run;

proc freq data=origin_make noprint;
table origin / out= distinct_freq;
run;

title 'PROC FREQ';
proc print data=distinct_freq;
run;
title 'PROC SQL';
proc print data=distinct_sql;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/count_distinct_by_group" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/count_distinct_by_group&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 17:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400143#M20860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-01T17:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique variables associated with one firm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400443#M20876</link>
      <description>&lt;P&gt;Thank you. I now used a proc freq as follows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=sortedibes noprint order=freq;&lt;BR /&gt;tables CUSIP*ANALYS*FPEDATS /out=counts;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc means data=counts max;&lt;BR /&gt;class CUSIP ANALYS;&lt;BR /&gt;var COUNT;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get the&amp;nbsp;total value for unique ANALYS for a particular cusip on a particular date with is FPEDATS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 20:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400443#M20876</guid>
      <dc:creator>dlazer1</dc:creator>
      <dc:date>2017-10-02T20:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Count unique variables associated with one firm</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400474#M20879</link>
      <description>&lt;P&gt;Use a WHERE statement to restrict your output.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 22:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Count-unique-variables-associated-with-one-firm/m-p/400474#M20879</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-02T22:31:36Z</dc:date>
    </item>
  </channel>
</rss>

