<?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 Curious datetime issue in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Curious-datetime-issue/m-p/92177#M946</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My program needs to compare the previous month/year (SEP2012) with the month/year of entries in a data set, in order to only extract entries from the previous month. My program successfully uses substr to extract the value "OCT2012" from the data set variable, which is in datetime20. format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem arises when I'm trying to create a value for the previous month, because for some reason it appears as "01SEP12:00:00:00", meaning that the subst function cannot get "SEP2012" from it, only "SEP12".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that is being used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let last_month = %sysfunc(intnx(month, %sysfunc(today()), -1), date.):00:00:00;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The peculiar thing (to me) is that the following almost identical code was used to get it in the correct format ("01SEP&lt;STRONG&gt;20&lt;/STRONG&gt;12:00:00:00") from the exact same data set variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let recent_monday = %sysfunc(intnx(week1.2, %sysfunc(today()),0,b), date.):00:00:00;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is, how can I edit the first line of code so that it extracts the full datetime, rather than abbreviating the year from 2012 to 12? I need it to be "01SEP2012:00:00:00".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2012 13:33:47 GMT</pubDate>
    <dc:creator>EinarRoed</dc:creator>
    <dc:date>2012-10-11T13:33:47Z</dc:date>
    <item>
      <title>Curious datetime issue</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Curious-datetime-issue/m-p/92177#M946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My program needs to compare the previous month/year (SEP2012) with the month/year of entries in a data set, in order to only extract entries from the previous month. My program successfully uses substr to extract the value "OCT2012" from the data set variable, which is in datetime20. format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem arises when I'm trying to create a value for the previous month, because for some reason it appears as "01SEP12:00:00:00", meaning that the subst function cannot get "SEP2012" from it, only "SEP12".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code that is being used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let last_month = %sysfunc(intnx(month, %sysfunc(today()), -1), date.):00:00:00;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The peculiar thing (to me) is that the following almost identical code was used to get it in the correct format ("01SEP&lt;STRONG&gt;20&lt;/STRONG&gt;12:00:00:00") from the exact same data set variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;%let recent_monday = %sysfunc(intnx(week1.2, %sysfunc(today()),0,b), date.):00:00:00;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my question is, how can I edit the first line of code so that it extracts the full datetime, rather than abbreviating the year from 2012 to 12? I need it to be "01SEP2012:00:00:00".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 13:33:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Curious-datetime-issue/m-p/92177#M946</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2012-10-11T13:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Curious datetime issue</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Curious-datetime-issue/m-p/92178#M947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use date9.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 13:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Curious-datetime-issue/m-p/92178#M947</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2012-10-11T13:40:15Z</dc:date>
    </item>
  </channel>
</rss>

