<?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 Rename External File in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586774#M75833</link>
    <description>&lt;P&gt;I currently receive a daily file with an odd naming format.&amp;nbsp; The file name format is&amp;nbsp;CFXTRN(9.5.2019), no extension.&amp;nbsp; I need to change the name to CFXTRN0905.&amp;nbsp; I use the code below to change the name which works great, except when it is a 1 digit day of the month, such as 9/5/2019.&amp;nbsp; How can I update my code so that it works for 1 or 2 digit day of the month?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA STEP2;&lt;BR /&gt;DATE3 = PUT("&amp;amp;DATE2.",$10.);&lt;BR /&gt;DATE4 = Substr(DATE3,Verify(DATE3,'0'));&lt;BR /&gt;CALL symput('FILEINA',COMPRESS("CFXTRN" !! "(" !! date4 !! ")"));&lt;BR /&gt;CALL SYMPUT('FILEOUT',CAT("CFXTRN","&amp;amp;DATE1."));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;FILECFX=RENAME("&amp;amp;SOURCE.\&amp;amp;FILEINA","&amp;amp;SOURCE.\&amp;amp;FILEOUT.","FILE");&lt;BR /&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2019 14:06:18 GMT</pubDate>
    <dc:creator>arjessup</dc:creator>
    <dc:date>2019-09-06T14:06:18Z</dc:date>
    <item>
      <title>Rename External File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586774#M75833</link>
      <description>&lt;P&gt;I currently receive a daily file with an odd naming format.&amp;nbsp; The file name format is&amp;nbsp;CFXTRN(9.5.2019), no extension.&amp;nbsp; I need to change the name to CFXTRN0905.&amp;nbsp; I use the code below to change the name which works great, except when it is a 1 digit day of the month, such as 9/5/2019.&amp;nbsp; How can I update my code so that it works for 1 or 2 digit day of the month?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA STEP2;&lt;BR /&gt;DATE3 = PUT("&amp;amp;DATE2.",$10.);&lt;BR /&gt;DATE4 = Substr(DATE3,Verify(DATE3,'0'));&lt;BR /&gt;CALL symput('FILEINA',COMPRESS("CFXTRN" !! "(" !! date4 !! ")"));&lt;BR /&gt;CALL SYMPUT('FILEOUT',CAT("CFXTRN","&amp;amp;DATE1."));&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;FILECFX=RENAME("&amp;amp;SOURCE.\&amp;amp;FILEINA","&amp;amp;SOURCE.\&amp;amp;FILEOUT.","FILE");&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586774#M75833</guid>
      <dc:creator>arjessup</dc:creator>
      <dc:date>2019-09-06T14:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename External File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586778#M75834</link>
      <description>&lt;P&gt;Please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA STEP2;
DATE3 = put(input("&amp;amp;sysdate9.",date9.),ddmmyy10.);
DATE3_ = prxchange('s/(0)(\d{1,2}\.)(0)(\d{1,2}\.)(\d{4})/$2$4$5/',-1,strip(tranwrd(put(input("&amp;amp;sysdate9.",date9.),ddmmyy10.),'/','.')));
DATE4 = compress(Substr(DATE3,1,5),'/');
CALL symput('FILEINA',COMPRESS("CFXTRN" !! "(" !! DATE3_ !! ")"));
CALL SYMPUT('FILEOUT',CAT("CFXTRN",DATE4));
RUN;

%put &amp;amp;FILEINA &amp;amp;FILEOUT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586778#M75834</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-06T14:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rename External File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586789#M75835</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; That works.&amp;nbsp; I would've never been able to do the DATE3_ code.&amp;nbsp; It might as well have been written in wingdings, but I am very grateful for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 14:54:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Rename-External-File/m-p/586789#M75835</guid>
      <dc:creator>arjessup</dc:creator>
      <dc:date>2019-09-06T14:54:25Z</dc:date>
    </item>
  </channel>
</rss>

