<?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 set year of date based bon proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/set-year-of-date-based-bon-proc-sql/m-p/473553#M121546</link>
    <description>&lt;P&gt;dear all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you please give me suggestions about how to restrict the year of '&lt;STRONG&gt;earliest_publn_date'&lt;/STRONG&gt; not equal to 9999?&lt;/P&gt;&lt;P&gt;when I use following codes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CREATE TABLE No_of_citation AS
   SELECT
   t_base.psn_name,
   COUNT(DISTINCT t_do.docdb_family_id)
   FROM base_of_citation AS t_base
   JOIN Sample.Applications AS t_ap1 ON t_ap1.docdb_family_id=t_base.docdb_family_id_base  
   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_family_id
   JOIN Sample.Publications AS t_pu ON t_pu.appln_id=t_ap2.appln_id
  WHERE
   &lt;STRONG&gt;YEAR(t_ap1.earliest_publn_date) != 9999
   AND YEAR(t_pu.publn_date) != 9999&lt;/STRONG&gt;
   AND t_pu.publn_date &amp;lt;= intnx('year',t_ap1.earliest_publn_date,6)                                   
  ;
QUIT;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the result like this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;329  PROC SQL;
330    CREATE TABLE No_of_citation AS
331
332     SELECT
333
334     t_base.psn_name,
335
336     COUNT(DISTINCT t_do.docdb_family_id)
337
338     FROM base_of_citation AS t_base
339
340     JOIN Sample.Applications AS t_ap1 ON t_ap1.docdb_family_id=t_base.docdb_family_id_base
341
342          /* in order to set the moving window */
343
344     JOIN Sample.Docdbfamiliescitations AS t_do ON
344! t_do.cited_docdb_family_id=t_base.docdb_family_id_base
345
346     JOIN Sample.Applications AS t_ap2 ON t_ap2.docdb_family_id=t_do.docdb_family_id
347
348     JOIN Sample.Publications AS t_pu ON t_pu.appln_id=t_ap2.appln_id
349
350    WHERE
351
352     YEAR(t_ap1.earliest_publn_date) !=9999
                                         -
                                         22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT,
              SUBSTRING, USER.

353
354     AND YEAR(t_pu.publn_date) !=9999
354     AND YEAR(t_pu.publn_date) !=9999
                                   -
                                   22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT,
              SUBSTRING, USER.

355
356     AND t_pu.publn_date &amp;lt;= intnx('year',t_ap1.earliest_publn_date,6)
357
358                                      /* a 6-year moving window starting at the earliest
358! publication date of a patent famliy */
359
360     ORDER BY t_base.psn_name
361
362    ;
363  QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the information about publn_date looks like following,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Column Name", "Type", "Length", "Format", "Informat", "Label", "Transcode",&lt;/P&gt;&lt;P&gt;"publn_date", "Number", "8", "YYMMDDD10.", "", "", "No",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jun 2018 21:56:17 GMT</pubDate>
    <dc:creator>France</dc:creator>
    <dc:date>2018-06-26T21:56:17Z</dc:date>
    <item>
      <title>set year of date based bon proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/set-year-of-date-based-bon-proc-sql/m-p/473553#M121546</link>
      <description>&lt;P&gt;dear all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you please give me suggestions about how to restrict the year of '&lt;STRONG&gt;earliest_publn_date'&lt;/STRONG&gt; not equal to 9999?&lt;/P&gt;&lt;P&gt;when I use following codes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
  CREATE TABLE No_of_citation AS
   SELECT
   t_base.psn_name,
   COUNT(DISTINCT t_do.docdb_family_id)
   FROM base_of_citation AS t_base
   JOIN Sample.Applications AS t_ap1 ON t_ap1.docdb_family_id=t_base.docdb_family_id_base  
   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_family_id
   JOIN Sample.Publications AS t_pu ON t_pu.appln_id=t_ap2.appln_id
  WHERE
   &lt;STRONG&gt;YEAR(t_ap1.earliest_publn_date) != 9999
   AND YEAR(t_pu.publn_date) != 9999&lt;/STRONG&gt;
   AND t_pu.publn_date &amp;lt;= intnx('year',t_ap1.earliest_publn_date,6)                                   
  ;
QUIT;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the result like this,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;329  PROC SQL;
330    CREATE TABLE No_of_citation AS
331
332     SELECT
333
334     t_base.psn_name,
335
336     COUNT(DISTINCT t_do.docdb_family_id)
337
338     FROM base_of_citation AS t_base
339
340     JOIN Sample.Applications AS t_ap1 ON t_ap1.docdb_family_id=t_base.docdb_family_id_base
341
342          /* in order to set the moving window */
343
344     JOIN Sample.Docdbfamiliescitations AS t_do ON
344! t_do.cited_docdb_family_id=t_base.docdb_family_id_base
345
346     JOIN Sample.Applications AS t_ap2 ON t_ap2.docdb_family_id=t_do.docdb_family_id
347
348     JOIN Sample.Publications AS t_pu ON t_pu.appln_id=t_ap2.appln_id
349
350    WHERE
351
352     YEAR(t_ap1.earliest_publn_date) !=9999
                                         -
                                         22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT,
              SUBSTRING, USER.

353
354     AND YEAR(t_pu.publn_date) !=9999
354     AND YEAR(t_pu.publn_date) !=9999
                                   -
                                   22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string,
              a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT,
              SUBSTRING, USER.

355
356     AND t_pu.publn_date &amp;lt;= intnx('year',t_ap1.earliest_publn_date,6)
357
358                                      /* a 6-year moving window starting at the earliest
358! publication date of a patent famliy */
359
360     ORDER BY t_base.psn_name
361
362    ;
363  QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the information about publn_date looks like following,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Column Name", "Type", "Length", "Format", "Informat", "Label", "Transcode",&lt;/P&gt;&lt;P&gt;"publn_date", "Number", "8", "YYMMDDD10.", "", "", "No",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 21:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/set-year-of-date-based-bon-proc-sql/m-p/473553#M121546</guid>
      <dc:creator>France</dc:creator>
      <dc:date>2018-06-26T21:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: set year of date based bon proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/set-year-of-date-based-bon-proc-sql/m-p/473556#M121547</link>
      <description>&lt;P&gt;Try NE instead of the != . NE is short for "not equal", there are also GT, LT, GE and LE for "greater than", "less than", "greater than or equal" and "less than or equal".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Creating fictitious date values, assuming you have them with year 9999 for a "not actual value" is really not needed. Just set the dates as missing and then use:&amp;nbsp; not missing(t_pu&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;publn_date).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 22:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/set-year-of-date-based-bon-proc-sql/m-p/473556#M121547</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-26T22:18:43Z</dc:date>
    </item>
  </channel>
</rss>

