<?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: Exporting a table in a particular range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864204#M341302</link>
    <description>&lt;P&gt;The range= option may not avaliable when exporting Microsoft Excel files using the XLS and XLSX Identifiers: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58 &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I recommend you the DDE method, it may be old, but very useful:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=sashelp.class outfile='C:\Profiles\test.xlsx' dbms=xlsx replace;
  newfile=yes;
  sheet='Sheet1';
run;

options noxwait noxsync;
x '"C:\Profiles\test.xlsx"';
%let rc=%sysfunc(sleep(5));      *Wait for opening Excel;

filename xlsx dde "excel|Sheet1!r23c2:r100c6";

data _null_;
  file xlsx;
  set sashelp.class;
  put name sex age height weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81547iE5E64D86048895F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 03:51:05 GMT</pubDate>
    <dc:creator>Hao_Luo</dc:creator>
    <dc:date>2023-03-15T03:51:05Z</dc:date>
    <item>
      <title>Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864137#M341285</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to export 1 table In particular range of a sheet that already contains data. I have indicated in the code to put the export from cell B6.&lt;BR /&gt;&lt;BR /&gt;proc export data=data&lt;BR /&gt;outfile="/Y/test/invoice" /* name and location of Excel file */&lt;BR /&gt;dbms=xlsx /* Excel file format */&lt;BR /&gt;replace;&lt;BR /&gt;range='B6:F6'; /* replace the file if it already exists */&lt;BR /&gt;sheet="base"; /* name of the sheet in Excel */&lt;BR /&gt;*putnames=no;/* start cell in Excel */&lt;BR /&gt;/* start from the second line without the headers */&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;But with this code, it does export the table to the right cells but it overwrites what was already there.&lt;BR /&gt;I don't see what option to add to tell it to keep the data that is already in the file.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any help</description>
      <pubDate>Tue, 14 Mar 2023 18:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864137#M341285</guid>
      <dc:creator>Gab12</dc:creator>
      <dc:date>2023-03-14T18:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864198#M341297</link>
      <description>&lt;P&gt;By specifying a cell range you are telling SAS to overwrite any existing data in that range with data from your SAS dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the XLSX LIBNAME engine and the PROC DATASETS APPEND statement to get closer to what you want.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 03:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864198#M341297</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-03-15T03:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864204#M341302</link>
      <description>&lt;P&gt;The range= option may not avaliable when exporting Microsoft Excel files using the XLS and XLSX Identifiers: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58 &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I recommend you the DDE method, it may be old, but very useful:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=sashelp.class outfile='C:\Profiles\test.xlsx' dbms=xlsx replace;
  newfile=yes;
  sheet='Sheet1';
run;

options noxwait noxsync;
x '"C:\Profiles\test.xlsx"';
%let rc=%sysfunc(sleep(5));      *Wait for opening Excel;

filename xlsx dde "excel|Sheet1!r23c2:r100c6";

data _null_;
  file xlsx;
  set sashelp.class;
  put name sex age height weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81547iE5E64D86048895F4/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 03:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864204#M341302</guid>
      <dc:creator>Hao_Luo</dc:creator>
      <dc:date>2023-03-15T03:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864218#M341313</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/440434"&gt;@Hao_Luo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The range= option may not avaliable when exporting Microsoft Excel files using the XLS and XLSX Identifiers: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58" target="_blank" rel="noopener"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p09degjribu2smn1eaqt5eq9on58 &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I recommend you the DDE method, it may be old, but very useful:&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;However the communications channels that DDE uses may be preempted by other programs.&lt;/P&gt;
&lt;P&gt;I had one process that used DDE, been a few years, but when our IT department added Cisco Jabber to our suite of standard applications the process no longer worked while Jabber was active. In this case I was able to KILL the Jabber process using Windows Task Manager, closing the application window was not sufficient, and it would run. But determining which programs may be interfering could be a nightmare.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 05:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864218#M341313</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-15T05:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864276#M341343</link>
      <description>&lt;P&gt;Hello everyone&lt;BR /&gt;Thank you for your help. I will try to understand what you have suggested.&lt;BR /&gt;I don't have much experience with SAS, so I don't understand everything I see here.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 13:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/864276#M341343</guid>
      <dc:creator>Gab12</dc:creator>
      <dc:date>2023-03-15T13:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910485#M359058</link>
      <description>&lt;P&gt;I am being told by sas that proc export does not allow&lt;/P&gt;&lt;P&gt;writing to a range yet you say you are doing it.&amp;nbsp; I have&lt;/P&gt;&lt;P&gt;included your post to them for resolution.&amp;nbsp; Any citations of&lt;/P&gt;&lt;P&gt;people writing to excel ranges would be appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 16:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910485#M359058</guid>
      <dc:creator>ASimpleCaveman</dc:creator>
      <dc:date>2024-01-04T16:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910502#M359070</link>
      <description>&lt;P&gt;One suspects that you asked a different question than just "export to range", such as the original poster of this thread that was OVERWRITING values already in the spreadsheet and not the desired behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example the online help for SAS 9.4.4 includes this portion:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-eDocBody"&gt;
&lt;DIV id="n0msy4hy1so0ren1acm90iijxn8j" class="xis-topic"&gt;
&lt;DIV id="p18zl68aqzqpl8n1vg3w6bugxcul" class="xis-subTopic"&gt;
&lt;DIV id="p0jgkrs850c26yn10vf4q3zvysp0" class="xis-topicContent"&gt;
&lt;DIV id="n1a2uiz96238yin14sjv2jvnqat8" class="xis-figure"&gt;
&lt;DIV class="xis-title"&gt;A Range of Data in an Excel Worksheet&lt;/DIV&gt;
&lt;DIV class="xis-graphicAndDescription"&gt;
&lt;DIV id="tinyMceEditorballardw_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p0uo2t0vm7cg1un1h480tdbzb8ea" class="xis-paragraph"&gt;The SAS C Files Server that works with &lt;SPAN class="xis-nobr"&gt;SAS/ACCESS&lt;/SPAN&gt; treats an Excel workbook as a database, and a range (subset of cells in a worksheet) as a table. A range name must be defined in the Excel file before SAS can use it. A worksheet is treated as a special range. A worksheet name appended with a $ character is treated as a range.&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Also there is a big difference between XLS, XLSX files and which versions of the Office suite are installed (or not) and what is possible with the Office files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 17:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910502#M359070</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-01-04T17:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910514#M359071</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461072"&gt;@ASimpleCaveman&lt;/a&gt;&amp;nbsp;- The &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#n1mtbwjta4v7ddn1v1mqfojo3hbq" target="_blank" rel="noopener"&gt;RANGE option&lt;/A&gt; is supported for both the EXCEL and EXCELCS DBMS options of PROC EXPORT but not for XLS and XLSX DBMSs. If your SAS servers run on Unix then the EXCEL option wont be available, but EXCELCS is if you have the SAS PC Files Server installed.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 19:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910514#M359071</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-01-04T19:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910570#M359085</link>
      <description>You could try "START_AT=" option of ODS EXCEL.&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sgf/2017/02/20/tips-for-using-the-ods-excel-destination/" target="_blank"&gt;https://blogs.sas.com/content/sgf/2017/02/20/tips-for-using-the-ods-excel-destination/&lt;/A&gt;</description>
      <pubDate>Fri, 05 Jan 2024 05:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910570#M359085</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-01-05T05:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Exporting a table in a particular range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910693#M359116</link>
      <description>re&amp;nbsp;Exporting a table in a particular range&lt;BR /&gt;&lt;BR /&gt;|&lt;BR /&gt;|&lt;BR /&gt;|&lt;BR /&gt;| | |&lt;BR /&gt;&lt;BR /&gt;|&lt;BR /&gt;&lt;BR /&gt;|&lt;BR /&gt;|&lt;BR /&gt;| |&lt;BR /&gt;Exporting a table in a particular range&lt;BR /&gt;&lt;BR /&gt;Hello, I would like to export 1 table In particular range of a sheet that already contains data. I have indicat...&lt;BR /&gt;|&lt;BR /&gt;&lt;BR /&gt;|&lt;BR /&gt;&lt;BR /&gt;|&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;he is using xlsx the same as i am so that is not an issue.&lt;BR /&gt;are yo saying that if i set the target xlsx up so that it has data inthe targeted cells and it has a named range it will work??</description>
      <pubDate>Fri, 05 Jan 2024 19:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exporting-a-table-in-a-particular-range/m-p/910693#M359116</guid>
      <dc:creator>ASimpleCaveman</dc:creator>
      <dc:date>2024-01-05T19:06:47Z</dc:date>
    </item>
  </channel>
</rss>

