<?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: A prxchange issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648481#M194272</link>
    <description>Wonderful anwser.</description>
    <pubDate>Mon, 18 May 2020 05:06:27 GMT</pubDate>
    <dc:creator>whymath</dc:creator>
    <dc:date>2020-05-18T05:06:27Z</dc:date>
    <item>
      <title>A prxchange issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648478#M194270</link>
      <description>&lt;P&gt;&amp;nbsp;Today, I have this bothering problem to ask for your help. Very preciate for your reading.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I an trying to change a datetime variable like '&lt;SPAN style="font-family: inherit;"&gt;&lt;CODE class=" language-sas"&gt;2020-05-18T9:27:58&lt;/CODE&gt;&lt;/SPAN&gt;' to its regular form '&lt;SPAN style="font-family: inherit;"&gt;&lt;CODE class=" language-sas"&gt;2020-05-18T09:27:58&lt;/CODE&gt;&lt;/SPAN&gt;', yes, that is the E8601DT format. So I code some tests like below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	DTMC = '2020-05-18T9:27:58';
	ADTMC1 = prxchange('s/(.*?T)(\d:.*)/$10$2/',1,DTMC);
	ADTMC2 = prxchange('s/(.*?T)(\d:.*)/$1 0$2/',1,DTMC);
	ADTMC3 = prxchange('s/(.*?)T(\d:.*)/$1T0$2/',1,DTMC);
	put (ADTMC:) (=/);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Here is the output:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ADTMC1=9:27:58
ADTMC2=2020-05-18T 09:27:58
ADTMC3=2020-05-18T09:27:58
&lt;/PRE&gt;
&lt;P&gt;As you can see, Only&amp;nbsp;&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;&lt;CODE class=" language-sas"&gt;ADTMC3&lt;/CODE&gt;&lt;/SPAN&gt; meet the desire.&lt;/P&gt;
&lt;P&gt;I am very sure that &amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;&lt;CODE class=" language-sas"&gt;$10&lt;/CODE&gt;&lt;/SPAN&gt;&amp;nbsp;in the first expression&amp;nbsp;is trying to catch the 10th match group, which is failed, finally.&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;&lt;CODE class=" language-sas"&gt;$1 0$2&lt;/CODE&gt;&lt;/SPAN&gt;&amp;nbsp;in the&amp;nbsp;second expression successfully catch the first and second match group and add '0' between it, with an extra space.&lt;/P&gt;
&lt;P&gt;May I modify&amp;nbsp;the first expression to have the right result? Thanks for any hints.&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 03:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648478#M194270</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2020-05-18T03:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: A prxchange issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648480#M194271</link>
      <description>&lt;P&gt;You only need to match the substring(s) that you want to change. In your case, it is quite simple:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	DTMC = '2020-05-18T9:27:58';
	ADTMC1 = prxchange('s/T(\d):/T0\1:/', 1, DTMC);
	put (ADTMC:) (=/);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 May 2020 04:03:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648480#M194271</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-05-18T04:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: A prxchange issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648481#M194272</link>
      <description>Wonderful anwser.</description>
      <pubDate>Mon, 18 May 2020 05:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-prxchange-issue/m-p/648481#M194272</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2020-05-18T05:06:27Z</dc:date>
    </item>
  </channel>
</rss>

