<?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: Substring Question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227105#M267890</link>
    <description>You know, upon further reflection I suppose there is no harm in leaving it numeric. I had to modify your statement slightly:&lt;BR /&gt;&lt;BR /&gt;%let date = %sysfunc(inputn(%qsubstr(&amp;amp;pdeg,2,10), mmddyy10.), yymmddn8.); &lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
    <pubDate>Thu, 24 Sep 2015 15:36:54 GMT</pubDate>
    <dc:creator>Ody</dc:creator>
    <dc:date>2015-09-24T15:36:54Z</dc:date>
    <item>
      <title>Substring Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227090#M267887</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm encountering an irritating problem I was hoping to get some input on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have a global dates macro in our environment that I'm using to get a list of date variables. I'm using this for another program I'm writing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The date I'm given from our gloal macro is formatted 'MM/DD/YYYY'. The variable &lt;SPAN&gt;&amp;amp;pdeg resolves to '09/23/2015'.&lt;/SPAN&gt;&amp;nbsp;I want to rearrange the date so that it's YYYYMMDD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let date = %sysfunc(&lt;BR /&gt;cat(&lt;BR /&gt;%qsubstr(&amp;amp;pdeg,8,4),&lt;BR /&gt;%qsubstr(&amp;amp;pdeg,2,2),&lt;BR /&gt;%qsubstr(&amp;amp;pdeg,5,2)&lt;BR /&gt;)&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem with this is that &amp;nbsp;it's giving me the result of 2015923. I'm losing the 0. It's driving me crazy. I know there is a simple solution here but it's evading me. Appreciate any assistance!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227090#M267887</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2015-09-24T15:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Substring Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227094#M267888</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let pdeg=09/23/2015;
%let date = %sysfunc(putn(%sysfunc(inputn(&amp;amp;pdeg,mmddyy10.)),yymmddn8.));
%put &amp;amp;date;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2015 15:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227094#M267888</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-24T15:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Substring Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227098#M267889</link>
      <description>Why complicate things by adding the CAT function? %let date = %substr(&amp;amp;pdeg,8,4)/%substr(&amp;amp;pdeg,2,2)/%substr(&amp;amp;pdeg,5,2);</description>
      <pubDate>Thu, 24 Sep 2015 15:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227098#M267889</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-09-24T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Substring Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227105#M267890</link>
      <description>You know, upon further reflection I suppose there is no harm in leaving it numeric. I had to modify your statement slightly:&lt;BR /&gt;&lt;BR /&gt;%let date = %sysfunc(inputn(%qsubstr(&amp;amp;pdeg,2,10), mmddyy10.), yymmddn8.); &lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Thu, 24 Sep 2015 15:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227105#M267890</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2015-09-24T15:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Substring Question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227121#M267891</link>
      <description>&lt;P&gt;If your PDEG variable was built from something else It might be even easier to use that instead of a string.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 16:39:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-Question/m-p/227121#M267891</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-24T16:39:47Z</dc:date>
    </item>
  </channel>
</rss>

