<?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: How to efficiently count the number per month from 1991 to 2015? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488856#M127481</link>
    <description>&lt;P&gt;Create a variable that contains the month in format YYYYMM, and use that in a class (or by - sorting needed) statement in proc summary, or as a group by in SQL.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Aug 2018 13:05:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-22T13:05:27Z</dc:date>
    <item>
      <title>How to efficiently count the number per month from 1991 to 2015?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488852#M127478</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I employed the following codes to count the number of cited 'docdb_family_id' per company &lt;U&gt;per year.&lt;/U&gt; I first create a table to locate the&amp;nbsp;&lt;SPAN&gt;'docdb_family_id' for each 'psn_name' per year&amp;nbsp;and then count the count the number of citation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class="language-sas"&gt;PROC SQL;
CREATE TABLE Step1.base_of_citation AS
SELECT
DISTINCT
Docdb_family_id AS docdb_family_id_base, co.psn_name
FROM sample.applications AS ap
JOIN sample.personapplication AS pe ON ap.appln_id = pe.appln_id
JOIN sample.companies AS co ON pe.person_id = co.person_id
JOIN sample.Publications AS pu ON ap.appln_id = pu.appln_id
JOIN sample.Citations AS ci ON pu.pat_publn_id = ci.pat_publn_id
WHERE applt_seq_nr &amp;gt; 0 /* to force the query to look only at persons who are applicants*/
AND granted = 1 /* there exists a publication of the grant */
&lt;U&gt;AND earliest_filing_date &amp;gt;= '01Jan1990'd
AND earliest_filing_date &amp;lt;= '31Dec1990'd&lt;/U&gt;
AND ci.cited_pat_publn_id &amp;gt; 0 
GROUP BY psn_name
ORDER BY psn_name
;
QUIT;

PROC SQL;
CREATE TABLE Step1.No_of_citation AS
SELECT
t_base.psn_name,
COUNT(DISTINCT t_do.docdb_family_id) AS No_of_citation
FROM Step1.base_of_citation AS t_base
JOIN Sample.Applications AS t_ap1 ON t_ap1.docdb_family_id = t_base.docdb_family_id_base
/* to set the moving window */
JOIN Sample.Docdbfamiliescitations AS t_do ON t_do.cited_docdb_family_id=t_ base.docdb_family_id_base
JOIN Sample.Applications AS t_ap2 ON t_ap2.docdb_family_id=t_do.docdb_famil y_id
JOIN Sample.Publications AS t_pu ON t_pu.appln_id=t_ap2.appln_id
WHERE YEAR(t_ap1.earliest_publn_date) NE 9999
GROUP BY t_base.psn_name
ORDER BY t_base.psn_name
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But now, I need to count the number of &lt;SPAN&gt;'docdb_family_id'&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;U&gt;per month from 1991 to 2015. &lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you please give me some suggestion about how to efficiently count the number of it? Is there any method I can use to calculate them by typing codes only one time rather than around 280 times?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;France&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 12:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488852#M127478</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-08-22T12:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to efficiently count the number per month from 1991 to 2015?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488856#M127481</link>
      <description>&lt;P&gt;Create a variable that contains the month in format YYYYMM, and use that in a class (or by - sorting needed) statement in proc summary, or as a group by in SQL.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 13:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488856#M127481</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-22T13:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to efficiently count the number per month from 1991 to 2015?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488914#M127515</link>
      <description>&lt;P&gt;PROC FREQ with a format applied will summarize by year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=YOUR_DATA_NAME;
table earliest_filing_date / out=want;
&lt;FONT color="#800080"&gt;&lt;STRONG&gt;format earliest_filing_date year4.;&lt;/STRONG&gt;&lt;/FONT&gt;
run;


proc print data=want;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Aug 2018 14:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-efficiently-count-the-number-per-month-from-1991-to-2015/m-p/488914#M127515</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-22T14:59:06Z</dc:date>
    </item>
  </channel>
</rss>

