<?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: Rename Excel template then export to newly renamed file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732957#M228401</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suggest to read &lt;A href="https://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/" target="_self"&gt;this&lt;/A&gt; blog and then re-think DDE usage.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Apr 2021 07:34:28 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-04-12T07:34:28Z</dc:date>
    <item>
      <title>Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732403#M228225</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am hoping there is programming language that will save me some steps.&amp;nbsp; I want to take an existing excel template file ("&amp;amp;ROOT\CHOICES__template.xlsx")&amp;nbsp; either rename it or create a copy with a new filename "&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to be followed by an export to the newly-renamed XLSX file:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA=COMPANY.&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._matcha&lt;BR /&gt;OUTFILE= "&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate"&lt;BR /&gt;DBMS=XLSX REPLACE;&lt;BR /&gt;SHEET="CHOICES";&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 06:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732403#M228225</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T06:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732404#M228226</link>
      <description>&lt;P&gt;Maybe i don't understand the process you try to create, but proc export will overwrite the existing file. So the first step seems to be redundant.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 06:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732404#M228226</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-09T06:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732405#M228227</link>
      <description>&lt;P&gt;Thanks. The “existing” file does not yet exist, at least not with the customized name. &lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 06:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732405#M228227</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T06:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732407#M228228</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296215"&gt;@texasmfp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks. The “existing” file does not yet exist, at least not with the customized name.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;After copying the template file, it hopefully exists as &amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate. Afterwards proc export will overwrite the before copied file, hence you can skip the copy-step in your process.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 06:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732407#M228228</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-09T06:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732410#M228229</link>
      <description>&lt;P&gt;Perhaps I am not explaining myself clearly, because that is exactly what I am trying to automate.&amp;nbsp; I do not want to manually copy the excel template and rename it as &amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate&lt;/P&gt;
&lt;P&gt;I want SAS to do that so that each time it creates a unique name.&amp;nbsp; The template is not a blank file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, today I run it and the file name resolves to&lt;/P&gt;
&lt;P&gt;ACME_FINAL_BASE1_CHOICES__09APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, if I run it tomorrow, I want the name to be&lt;/P&gt;
&lt;P&gt;ACME_FINAL_BASE1_CHOICES__10APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR, if I run it for a different company, it would be&lt;/P&gt;
&lt;P&gt;AJAX_FINAL_BASE1_CHOICES__09APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 07:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732410#M228229</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T07:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732411#M228230</link>
      <description>&lt;P&gt;Essentially, I want to do two things:&amp;nbsp; write a dataset to an existing Excel template and save that with a new name (or in reverse, create a copy of an existing excel template with a new name, and then write a SAS dataset to that new file).&amp;nbsp; The new filename is populated with macros variables that can resolve differently on different days or with different company names or segment names, etc....&amp;nbsp; I can write to a blank Excel file and then manually copy that into a template and then rename the template.&amp;nbsp; Its a pain.&amp;nbsp; I am hoping there is a way to automate this in SAS.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 07:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732411#M228230</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T07:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732436#M228234</link>
      <description>&lt;P&gt;Use function fcopy() to copy the template, then export your data to the new file.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 08:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732436#M228234</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-09T08:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732448#M228236</link>
      <description>&lt;P&gt;Use FCOPY() to create the copy. Then, define a LIBNAME XLSX for the copy, and use a DATA step or PROC COPY to create the new sheet within the workbook file.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 09:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732448#M228236</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-09T09:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732501#M228244</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296215"&gt;@texasmfp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Perhaps I am not explaining myself clearly, because that is exactly what I am trying to automate.&amp;nbsp; I do not want to manually copy the excel template and rename it as &amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate&lt;/P&gt;
&lt;P&gt;I want SAS to do that so that each time it creates a unique name.&amp;nbsp; The template is not a blank file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, today I run it and the file name resolves to&lt;/P&gt;
&lt;P&gt;ACME_FINAL_BASE1_CHOICES__09APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, if I run it tomorrow, I want the name to be&lt;/P&gt;
&lt;P&gt;ACME_FINAL_BASE1_CHOICES__10APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OR, if I run it for a different company, it would be&lt;/P&gt;
&lt;P&gt;AJAX_FINAL_BASE1_CHOICES__09APR21.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Proc export does not "write to a template", it does not "fill in cells" or any manner of those things. Proc EXPORT creates files. If there is a file of the existing name it completely replaces it. There is no "template" information left. Period. You need an approach other than Proc Export for generating your output.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 14:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732501#M228244</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-09T14:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732522#M228255</link>
      <description>&lt;P&gt;As I understand it, you have an xlsx file with predefined formats, macros etc. You want the new file to use this preexisting file as the template and create a new one.&lt;/P&gt;
&lt;P&gt;In my opinion , your code should&lt;/P&gt;
&lt;P&gt;(1) make a copy the template excel workbook to a new copy with the desired name&lt;/P&gt;
&lt;P&gt;(2) use DDE to populate data into the new workbook (see item 9 in&amp;nbsp;&lt;A href="https://support.sas.com/kb/32/455.html" target="_blank"&gt;https://support.sas.com/kb/32/455.html&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;SAS needs to be running on windows for this to work.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 15:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732522#M228255</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-04-09T15:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732538#M228265</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;As I understand it, you have an xlsx file with predefined formats, macros etc. You want the new file to use this preexisting file as the template and create a new one.&lt;/P&gt;
&lt;P&gt;In my opinion , your code should&lt;/P&gt;
&lt;P&gt;(1) make a copy the template excel workbook to a new copy with the desired name&lt;/P&gt;
&lt;P&gt;(2) use DDE to populate data into the new workbook (see item 9 in&amp;nbsp;&lt;A href="https://support.sas.com/kb/32/455.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/32/455.html&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;
&lt;P&gt;SAS needs to be running on windows for this to work.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately DDE is a very fragile approach to any solution even in the Windows operating system. The communication links that DDE relies on have been "hijacked" or similar by other fairly common programs. If you have Cisco Jabber running DDE will not work until the Jabber processes are Killed (not close the windows but go to Task Manager and Kill the running process). Other programs are likely doing the same. Microsoft doesn't maintain or even recommend DDE solutions anymore. So behavior of any program using DDE is subject to change.&lt;/P&gt;
&lt;P&gt;Also some of the commands that require specifying file types change depending on the version of Office installed and are also subject to change without notice.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 16:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732538#M228265</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-09T16:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732664#M228318</link>
      <description>&lt;P&gt;That is not true:&amp;nbsp; You can specify a sheet name in the PROC Export and, it only replaces what is in that sheet.&amp;nbsp; I do it all the time:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT DATA=COMPANY.&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._matcha&lt;BR /&gt;OUTFILE= "&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate"&lt;BR /&gt;DBMS=XLSX REPLACE;&lt;BR /&gt;SHEET="CHOICES";&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 23:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732664#M228318</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T23:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732665#M228319</link>
      <description>&lt;P&gt;Kurt, I tried that and it destroyed the template.&amp;nbsp; It was a .3 MB excel file before and a 1 kb excel file after that won't open in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I used, which came from a SAS, which I adopted from&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n10dz22b5ixohin1vwzilweetek0.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n10dz22b5ixohin1vwzilweetek0.htm&amp;amp;locale=en&lt;/A&gt; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Set MSGLEVEL to I to write messages from FCOPY to the log. */
options msglevel=i;

filename src 'E:\SAS Data\CHOICES__template.xlsx' recfm=n;
filename dest 'E:\SAS Data\CHOICES__template2.xlsx' recfm=n;

   /* Create an example file to copy. */
data _null_;
   file src;
   do i=1, 2105, 300312, 400501;
     put i:words256.;
   end;
run; 

data _null_;
   length msg $ 384;
   rc=fcopy('src', 'dest');
   if rc=0 then
      put 'Copied SRC to DEST.';
   else do;
      msg=sysmsg();
      put rc= msg=;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 23:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732665#M228319</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T23:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732666#M228320</link>
      <description>&lt;P&gt;Chris, I tried that and it destroyed the template.&amp;nbsp; It was a .3 MG excel file beforte and a 1 kb excel file after that won't open in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I used, which came from a SAS, which I adopted from&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n10dz22b5ixohin1vwzilweetek0.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n10dz22b5ixohin1vwzilweetek0.htm&amp;amp;locale=en&lt;/A&gt; :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Set MSGLEVEL to I to write messages from FCOPY to the log. */
options msglevel=i;

filename src 'E:\SAS Data\CHOICES__template.xlsx' recfm=n;
filename dest 'E:\SAS Data\CHOICES__template2.xlsx' recfm=n;

   /* Create an example file to copy. */
data _null_;
   file src;
   do i=1, 2105, 300312, 400501;
     put i:words256.;
   end;
run; 

data _null_;
   length msg $ 384;
   rc=fcopy('src', 'dest');
   if rc=0 then
      put 'Copied SRC to DEST.';
   else do;
      msg=sysmsg();
      put rc= msg=;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 23:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732666#M228320</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-09T23:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732668#M228321</link>
      <description>&lt;P&gt;Resolved the code.&amp;nbsp; Works flawlessly.&amp;nbsp; Thanks to all for the tips.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Set MSGLEVEL to I to write messages from FCOPY to the log. */
options msglevel=i;

filename src '&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate\CHOICES__template.xlsx' recfm=n;
filename dest "&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate..xlsx" recfm=n;
 
data _null_;
   length msg $ 384;
   rc=fcopy('src', 'dest');
   if rc=0 then
      put 'Copied SRC to DEST.';
   else do;
      msg=sysmsg();
      put rc= msg=;
   end;
run;

PROC EXPORT DATA=COMPANY.&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._matcha
            OUTFILE= "&amp;amp;ROOT\&amp;amp;RESPONDENT._&amp;amp;SEGMENT._&amp;amp;STAGE._CHOICES__&amp;amp;sysdate"
            DBMS=XLSX REPLACE;
     SHEET="CHOICES";
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Apr 2021 01:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732668#M228321</guid>
      <dc:creator>texasmfp</dc:creator>
      <dc:date>2021-04-10T01:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732683#M228329</link>
      <description>&lt;P&gt;You can use &lt;FONT face="comic sans ms,sans-serif"&gt;outfile=DEST&lt;/FONT&gt; if you want, since you already have a &lt;EM&gt;filename&lt;/EM&gt; pointer.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Apr 2021 06:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732683#M228329</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-10T06:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Excel template then export to newly renamed file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732957#M228401</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131732"&gt;@Sajid01&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I strongly suggest to read &lt;A href="https://blogs.sas.com/content/sasdummy/2014/10/14/dde-is-doa/" target="_self"&gt;this&lt;/A&gt; blog and then re-think DDE usage.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 07:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Excel-template-then-export-to-newly-renamed-file/m-p/732957#M228401</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-04-12T07:34:28Z</dc:date>
    </item>
  </channel>
</rss>

