<?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 PROC EXPORT doesnt replace Access in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511455#M2172</link>
    <description>&lt;P&gt;I am using exactly this type of macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO EXPORT_TABLE(table, database, name);
	PROC EXPORT
	DATA = WORK.&amp;amp;table.
	OUTTABLE = "&amp;amp;name."
	DBMS = ACCESS REPLACE;
	DATABASE = &amp;amp;database.;
	RUN;
%MEND;

%EXPORT_TABLE(Somename, "path.mdb", Anothername);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, if the file already exists, SAS doesn't replace it, but makes the file bigger in size (number of rows/cols are preserved, but size of the file is higher). You can imagine how many problems this causes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way, how to deal with this? I have tried NEWFILE = yes;, but it doesn't work with access databases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 08 Nov 2018 18:02:02 GMT</pubDate>
    <dc:creator>Gateux</dc:creator>
    <dc:date>2018-11-08T18:02:02Z</dc:date>
    <item>
      <title>PROC EXPORT doesnt replace Access</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511455#M2172</link>
      <description>&lt;P&gt;I am using exactly this type of macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO EXPORT_TABLE(table, database, name);
	PROC EXPORT
	DATA = WORK.&amp;amp;table.
	OUTTABLE = "&amp;amp;name."
	DBMS = ACCESS REPLACE;
	DATABASE = &amp;amp;database.;
	RUN;
%MEND;

%EXPORT_TABLE(Somename, "path.mdb", Anothername);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, if the file already exists, SAS doesn't replace it, but makes the file bigger in size (number of rows/cols are preserved, but size of the file is higher). You can imagine how many problems this causes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way, how to deal with this? I have tried NEWFILE = yes;, but it doesn't work with access databases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 18:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511455#M2172</guid>
      <dc:creator>Gateux</dc:creator>
      <dc:date>2018-11-08T18:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC EXPORT doesnt replace Access</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511456#M2173</link>
      <description>Have you tried dropping the table first?</description>
      <pubDate>Thu, 08 Nov 2018 18:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511456#M2173</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-08T18:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC EXPORT doesnt replace Access</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511614#M2209</link>
      <description>&lt;P&gt;Hi, thank you for reply. Could you be more specific about dropping the table? Access is first time referenced in the macro. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 09:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511614#M2209</guid>
      <dc:creator>Gateux</dc:creator>
      <dc:date>2018-11-09T09:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: PROC EXPORT doesnt replace Access</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511725#M2236</link>
      <description>Create a libname reference to the Access DB. Then use PROC SQL or PROC DATASETS to delete the table in the ACCESS DB that you're not interested in and THEN do your creation/insert step.  &lt;BR /&gt;&lt;BR /&gt;My assumption - you have an Access DB and are replacing a table in the DB. If otherwise, provide more details on your question.&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Nov 2018 16:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/511725#M2236</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-09T16:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: PROC EXPORT doesnt replace Access</title>
      <link>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/512222#M2313</link>
      <description>&lt;P&gt;Unfortunately, this doesn't work. I implemented it into the macro in this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO EXPORT_TABLE(table, database, name);
LIBNAME ACC &amp;amp;database.;

PROC DATASETS LIB = ACC NOPRINT;
        DELETE &amp;amp;name.;
QUIT;


PROC EXPORT
	DATA = WORK.&amp;amp;table.
	OUTTABLE = "&amp;amp;name."
	DBMS = ACCESS REPLACE;
	DATABASE = &amp;amp;database.;
RUN;
%MEND;

%EXPORT_TABLE(Somename, "path.mdb", Anothername);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Log says that the libname was successfully assigned, also 'Deleting&amp;nbsp;ACC.tablename"... but still, the file size is increasing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Edit:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;When using with DIRECT_EXE and PROC SQL:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;LIBNAME ACC &amp;amp;database. DIRECT_EXE = DELETE;

PROC SQL; DELETE FROM ACC.&amp;amp;name.; QUIT;

LIBNAME ACC CLEAR;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems like working. The table itself is not deleted but just cleared (ie it is empty). However, the size doesn't apparently change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 16:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/PROC-EXPORT-doesnt-replace-Access/m-p/512222#M2313</guid>
      <dc:creator>Gateux</dc:creator>
      <dc:date>2018-11-12T16:20:12Z</dc:date>
    </item>
  </channel>
</rss>

