<?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 substr in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468064#M119522</link>
    <description>&lt;P&gt;does this code mean ?&lt;/P&gt;&lt;P&gt;death_date = mdy(substr(DateOfDeath,6,2),'15',substr(DateOfDeath,1,4)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jun 2018 14:20:55 GMT</pubDate>
    <dc:creator>manya92</dc:creator>
    <dc:date>2018-06-06T14:20:55Z</dc:date>
    <item>
      <title>substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468064#M119522</link>
      <description>&lt;P&gt;does this code mean ?&lt;/P&gt;&lt;P&gt;death_date = mdy(substr(DateOfDeath,6,2),'15',substr(DateOfDeath,1,4)) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 14:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468064#M119522</guid>
      <dc:creator>manya92</dc:creator>
      <dc:date>2018-06-06T14:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468072#M119526</link>
      <description>&lt;P&gt;Please try using even full sentences.&amp;nbsp; What do you not understand, have you looked up the functions given in that line?&lt;/P&gt;
&lt;P&gt;mdy() function accepts 3 numeric values representing month, day, year.&lt;/P&gt;
&lt;P&gt;substr() function cuts out a certain amount of characters from X position in a string for Y number of characters.&lt;/P&gt;
&lt;P&gt;This code is creating a death date variable with the day value 15 imputed.&amp;nbsp; Do note its not a good idea to put a character - '15'&amp;nbsp; - string in where a numeric is expected, this incurs implicit conversion.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 14:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468072#M119526</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-06T14:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468074#M119528</link>
      <description>&lt;P&gt;It's sloppy programming. It uses strings where numeric values are expected, forcing SAS to do an automatic conversion, which is never good and often bad.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the surface, this code makes a SAS date out of a string of 7 characters in the form 'yyyyXmm', where yyyy is a year and mm a month, and X any arbitrary character. Depending on the type and contents of DateOfDeath, this could work, or just get you missing values and lots of NOTEs in the log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 14:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468074#M119528</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-06T14:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468076#M119529</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would appear that someone has date values in a string and wants to set all of the same month and year to the 15th of the month. That is the purpose of the MDY function to take a month number (1 to 12) , day of month (1 to 31 BUT SAS will verify the number of days against the specific month) and year value&amp;nbsp;and return a SAS data value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would guess that the data dateofdeath was in the form of something like YYYY/MM&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 14:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468076#M119529</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-06T14:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468098#M119537</link>
      <description>I would also be double checking it. You have month at character 6 and year at character 1&lt;BR /&gt;YYYYXXMM -&amp;gt; it's almost unheard of to use this type of date formatting. It's usually YYYYMMDD.</description>
      <pubDate>Wed, 06 Jun 2018 15:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr/m-p/468098#M119537</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-06T15:15:36Z</dc:date>
    </item>
  </channel>
</rss>

