<?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: filter date entered in where clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784222#M250227</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have a date variable in a dataset and shows its data type as number and it is formatted as 2020-02-19.&lt;/P&gt;
&lt;P&gt;I need to filter data in a where clause in proc sql and pull only the year. How can I do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example dummy program:&lt;/P&gt;
&lt;PRE&gt;Proc sql;
     create table dummy as
     select *
     from some dataset 
     where year(datevariablename) = 2020
     ;
quit;
/* or if looking for multiple values of year with IN operator
    where year(datevariablename) in (2018 2020)
*/&lt;/PRE&gt;
&lt;P&gt;However if your data source is not a native SAS dataset such when connecting to an external database this may not work depending on a number of factors.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Dec 2021 22:32:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-12-05T22:32:54Z</dc:date>
    <item>
      <title>filter date entered in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784212#M250221</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have a date variable in a dataset and shows its data type as number and it is formatted as 2020-02-19.&lt;/P&gt;
&lt;P&gt;I need to filter data in a where clause in proc sql and pull only the year. How can I do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 21:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784212#M250221</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-12-05T21:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: filter date entered in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784215#M250224</link>
      <description>&lt;P&gt;Use the YEAR function to extract the year from a date.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 21:49:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784215#M250224</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-12-05T21:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: filter date entered in where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784222#M250227</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have a date variable in a dataset and shows its data type as number and it is formatted as 2020-02-19.&lt;/P&gt;
&lt;P&gt;I need to filter data in a where clause in proc sql and pull only the year. How can I do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Example dummy program:&lt;/P&gt;
&lt;PRE&gt;Proc sql;
     create table dummy as
     select *
     from some dataset 
     where year(datevariablename) = 2020
     ;
quit;
/* or if looking for multiple values of year with IN operator
    where year(datevariablename) in (2018 2020)
*/&lt;/PRE&gt;
&lt;P&gt;However if your data source is not a native SAS dataset such when connecting to an external database this may not work depending on a number of factors.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Dec 2021 22:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-date-entered-in-where-clause/m-p/784222#M250227</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-12-05T22:32:54Z</dc:date>
    </item>
  </channel>
</rss>

