<?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: Need help working with the dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174114#M44804</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Hai.kuo!&lt;/P&gt;&lt;P&gt;Worked really well. You're awesome:)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Feb 2015 14:45:10 GMT</pubDate>
    <dc:creator>greelights01</dc:creator>
    <dc:date>2015-02-19T14:45:10Z</dc:date>
    <item>
      <title>Need help working with the dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174112#M44802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Hi everyone, &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I am trying to work with a dataset and have been struggling with creating a new variable involving date.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;In my dataset (.sas7bdat), I have a variable with a date informat (mm/dd/yy10.). &lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;What I am trying to do is to create a variable called 'index' that codes 0 if date before 5/1/2010 and 1 if date is after 5/1/2010.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;I tried to code in a data step:&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;data one; set new;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;if date&amp;gt;=05/01/2010 then index=1;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;else index=0;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;When I proc print, the index=1 for all of my observations.&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;What is wrong with my code? I have been struggling for hours.. Please help!!&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 23:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174112#M44802</guid>
      <dc:creator>greelights01</dc:creator>
      <dc:date>2015-02-18T23:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need help working with the dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174113#M44803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"if date&amp;gt;=05/01/2010 then index=1;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date here is numeric, while&amp;nbsp;&amp;nbsp; 05/01/2010 is not. When comparing,&amp;nbsp; 05/01/2010 is taken as missing value which is the smallest. That is why you always get index=1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Switch it to :&lt;/P&gt;&lt;P&gt; "if date&amp;gt;='01MAY2010'D then index=1;"&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174113#M44803</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-19T14:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need help working with the dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174114#M44804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Hai.kuo!&lt;/P&gt;&lt;P&gt;Worked really well. You're awesome:)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174114#M44804</guid>
      <dc:creator>greelights01</dc:creator>
      <dc:date>2015-02-19T14:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help working with the dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174115#M44805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;05/01/2010 is not a valid date literal, but it is a valid numeric expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( (5/1)/2010 ) evaluates to 0.0024875, which interprets as 1 January 1960.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 16:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174115#M44805</guid>
      <dc:creator>Howles</dc:creator>
      <dc:date>2015-02-19T16:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need help working with the dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174116#M44806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aha, miss that part, should have run the test. Thanks, @Howles!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OP, please weight in this correct information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 16:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Need-help-working-with-the-dates/m-p/174116#M44806</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-19T16:29:16Z</dc:date>
    </item>
  </channel>
</rss>

