<?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: Append an existing file using Proc export in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928782#M44804</link>
    <description>&lt;P&gt;It is impossible for PROC EXPORT to append the data into existed XLSX file.&lt;/P&gt;
&lt;P&gt;But you could try LIBNAME + PROC SQL or PROC APPEND to workaround it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export
data=sashelp.class 
outfile="c:\temp\temp.xlsx"
dbms = xlsx replace;
sheet='xxxx';
run;

libname x excel "c:\temp\temp.xlsx"  SCAN_TEXT=NO;
proc append base=x.xxxx data=sashelp.class force;run;
libname x clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1715910240636.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96596i69A0BC3C6F59EA2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1715910240636.png" alt="Ksharp_0-1715910240636.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 01:44:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2024-05-17T01:44:10Z</dc:date>
    <item>
      <title>Append an existing file using Proc export</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928635#M44802</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export
data=sashelp.class 
outfile="TEST1"
dbms = xlsx replace;
run;

proc export data=sashelp.class
  outfile="TEST1"
  dbms=xlsx
  replace;
run;
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;SPAN&gt;I'm trying to append an existing file using Proc export, but it didn't work. &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;SPAN&gt;i&amp;nbsp;want&amp;nbsp;this&amp;nbsp;ouput&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_0-1715855445572.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96569i620C227228A12455/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_0-1715855445572.png" alt="Daily1_0-1715855445572.png" /&gt;&lt;/span&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 10:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928635#M44802</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2024-05-16T10:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Append an existing file using Proc export</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928664#M44803</link>
      <description>&lt;P&gt;I haven't seen a way of controlling this from within PROC EXPORT.&lt;/P&gt;
&lt;P&gt;What you can do though is to take the generated data step code generated by PROC EXPORT, and add the MOD option to the FILE statement option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; /**********************************************************************
  *   PRODUCT:   SAS
  *   VERSION:   9.4
  *   CREATOR:   External File Interface
  *   DATE:      16MAY24
  *   DESC:      Generated SAS Datastep Code
  *   TEMPLATE SOURCE:  (None Specified.)
  ***********************************************************************/
     data _null_;
     %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
     %let _EFIREC_ = 0;     /* clear export record count macro variable */
     file 'c:\Temp\sashelp_class.csv' delimiter=',' DSD DROPOVER lrecl=32767 mod;
     if _n_ = 1 then        /* write column names or labels */
      do;
        put
           "Name"
        ','
           "Sex"
        ','
           "Age"
        ','
           "Height"
        ','
           "Weight"
        ;
      end;
    set  SASHELP.CLASS   end=EFIEOD;
        format Name $8. ;
        format Sex $1. ;
        format Age best12. ;
        format Height best12. ;
        format Weight best12. ;
      do;
        EFIOUT + 1;
        put Name $ @;
        put Sex $ @;
        put Age @;
        put Height @;
        put Weight ;
;
      end;
     if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
     if EFIEOD then call symputx('_EFIREC_',EFIOUT);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 May 2024 13:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928664#M44803</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-05-16T13:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Append an existing file using Proc export</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928782#M44804</link>
      <description>&lt;P&gt;It is impossible for PROC EXPORT to append the data into existed XLSX file.&lt;/P&gt;
&lt;P&gt;But you could try LIBNAME + PROC SQL or PROC APPEND to workaround it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export
data=sashelp.class 
outfile="c:\temp\temp.xlsx"
dbms = xlsx replace;
sheet='xxxx';
run;

libname x excel "c:\temp\temp.xlsx"  SCAN_TEXT=NO;
proc append base=x.xxxx data=sashelp.class force;run;
libname x clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1715910240636.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/96596i69A0BC3C6F59EA2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1715910240636.png" alt="Ksharp_0-1715910240636.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 01:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Append-an-existing-file-using-Proc-export/m-p/928782#M44804</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-17T01:44:10Z</dc:date>
    </item>
  </channel>
</rss>

