<?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: Data set with if statement in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786347#M32217</link>
    <description>Thank you</description>
    <pubDate>Thu, 16 Dec 2021 18:30:56 GMT</pubDate>
    <dc:creator>sogauli6</dc:creator>
    <dc:date>2021-12-16T18:30:56Z</dc:date>
    <item>
      <title>Data set with if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786339#M32215</link>
      <description>To get a date range with ‘if’ statement . I only need to select 1981 year date there is 6 date with that year.&lt;BR /&gt;Data a;&lt;BR /&gt;Set Sonu. Emp;&lt;BR /&gt;If hiredate &amp;gt;= ‘20feb1981’d and &amp;lt;= ‘03dec1981’d;&lt;BR /&gt;Run;</description>
      <pubDate>Thu, 16 Dec 2021 18:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786339#M32215</guid>
      <dc:creator>sogauli6</dc:creator>
      <dc:date>2021-12-16T18:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data set with if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786343#M32216</link>
      <description>&lt;P&gt;You forgot the second hiredate&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data a;
Set Sonu. Emp;
If hiredate &amp;gt;= '20feb1981'd and  hiredate &amp;lt;= '03dec1981'd;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;But you can also use the YEAR function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data a;
Set Sonu. Emp;
If year(hiredate) = 1981;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and for ranges you can use something like this as well:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data a;
Set Sonu. Emp;
If  '20feb1981'd &amp;lt;= hiredate &amp;lt;= '03dec1981'd;
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/410198"&gt;@sogauli6&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;To get a date range with ‘if’ statement . I only need to select 1981 year date there is 6 date with that year.&lt;BR /&gt;Data a;&lt;BR /&gt;Set Sonu. Emp;&lt;BR /&gt;If hiredate &amp;gt;= ‘20feb1981’d and &amp;lt;= ‘03dec1981’d;&lt;BR /&gt;Run;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;EDIT: you also have curly quotes not straight ones (you copied and pasted from somewhere?). Those will likely cause an issue with your code and I've updated this post to fix those.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 18:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786343#M32216</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-16T18:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Data set with if statement</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786347#M32217</link>
      <description>Thank you</description>
      <pubDate>Thu, 16 Dec 2021 18:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Data-set-with-if-statement/m-p/786347#M32217</guid>
      <dc:creator>sogauli6</dc:creator>
      <dc:date>2021-12-16T18:30:56Z</dc:date>
    </item>
  </channel>
</rss>

