<?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: fixing time date value in a character string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382893#M91441</link>
    <description>&lt;P&gt;Presumably, you have thought this through and it would be satisfactory to keep the time of day but get rid of the day itself.&amp;nbsp; In any case, you need just one statement in your DO OVER loop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;change = substr(change, 7, 5) || ':' || substr(change, 3, 4);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 17:51:37 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-07-27T17:51:37Z</dc:date>
    <item>
      <title>fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382650#M91440</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; I have compressed date/time variables in a character string with values that now look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;312140AUG07&lt;/P&gt;
&lt;P&gt;311415MAY08&lt;/P&gt;
&lt;P&gt;092105MAR07&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first two numbers are the day(date). 3-6 is the time.&amp;nbsp; THen month and year....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like it to look like this format DDMMMYY:HHMM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I am doing is not working.&amp;nbsp; Appreciate your help!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data rr.datetime2006 (keep=Inc Alert Launch OnSce Locate Recov Deliv RTB);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set rr2006labels;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;array change _character_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;do over change;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;change=compress(change,'');&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;day=substr(change,1,2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time=substr(change,3,4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month=substr(change,7,3);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;year=substr (10,2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;date=catt(day,month,year);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;change=catt(date,time);&amp;nbsp; *want this to look like DDMMMYY:HHMM;&lt;BR /&gt;end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382650#M91440</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-07-27T18:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382893#M91441</link>
      <description>&lt;P&gt;Presumably, you have thought this through and it would be satisfactory to keep the time of day but get rid of the day itself.&amp;nbsp; In any case, you need just one statement in your DO OVER loop:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;change = substr(change, 7, 5) || ':' || substr(change, 3, 4);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 17:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382893#M91441</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-27T17:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382916#M91442</link>
      <description>year=substr (change,10,2);</description>
      <pubDate>Thu, 27 Jul 2017 17:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/382916#M91442</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2017-07-27T17:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383005#M91445</link>
      <description>&lt;P&gt;@astounding&amp;nbsp; I do need to keep the day in this.&amp;nbsp; I see what your saying though - correction I need the end format to be DDMMMYY:HHMM.&amp;nbsp; But even removing the day- i received an error in your code (Invalid third argument to function SUBSTR)&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:02:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383005#M91445</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-07-27T18:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383127#M91447</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; .  So keeping the day, I tried this and got an error:&lt;BR /&gt;&lt;BR /&gt;data rr.datetime2006 (keep=Inc Alert Launch OnSce Locate Recov Deliv RTB);&lt;BR /&gt;    set rr2006labels;&lt;BR /&gt;         array change _character_;&lt;BR /&gt;		        do over change;&lt;BR /&gt;        change=compress(change,'');&lt;BR /&gt;		change=substr(change,1,2)||substr(change,7,5)||':'||substr (change,3,4);&lt;BR /&gt;end;&lt;BR /&gt;    run;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383127#M91447</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-07-27T18:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383175#M91448</link>
      <description>&lt;P&gt;The code is correct.&amp;nbsp; I suspect that _CHARACTER_ is incorrect and includes some character variables that contain fewer than 12 characters.&amp;nbsp; If that's the case, you might have to replace _CHARACTER_ with a list of just the appropriate variable names.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 18:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383175#M91448</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-27T18:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: fixing time date value in a character string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383259#M91450</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;.  you were correct.  That worked perfectly!  Thank you!</description>
      <pubDate>Thu, 27 Jul 2017 18:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/fixing-time-date-value-in-a-character-string/m-p/383259#M91450</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-07-27T18:26:12Z</dc:date>
    </item>
  </channel>
</rss>

