<?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 Export SAS dataset to a Range on an Excel Spreadsheet in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227858#M41098</link>
    <description>&lt;P&gt;Hi, I was hoping someone could help with the following. &amp;nbsp;I have a number of SAS datasets that I want to export onto the same sheet in an Excel spreadsheet. &amp;nbsp;This is the code that I am using :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=lib.FreqGender outfile="&amp;amp;ProjPath\V005.xlsx"&lt;BR /&gt; dbms=xlsx&lt;BR /&gt; replace;&lt;BR /&gt; sheet=Demographics;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, conceptually what I am trying to do is this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=lib.FreqGender outfile="&amp;amp;ProjPath\V005.xlsx"&lt;BR /&gt; dbms=xlsx&lt;BR /&gt; replace;&lt;BR /&gt; sheet=Demographics;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;range=gender;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i.e. I have defined a cell range called gender in the sheet called demographics, where I want to export the contents of the SAS dataset called FreqGender. &amp;nbsp;Any ideas ?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2015 14:54:26 GMT</pubDate>
    <dc:creator>alan0101</dc:creator>
    <dc:date>2015-09-30T14:54:26Z</dc:date>
    <item>
      <title>Export SAS dataset to a Range on an Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227858#M41098</link>
      <description>&lt;P&gt;Hi, I was hoping someone could help with the following. &amp;nbsp;I have a number of SAS datasets that I want to export onto the same sheet in an Excel spreadsheet. &amp;nbsp;This is the code that I am using :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=lib.FreqGender outfile="&amp;amp;ProjPath\V005.xlsx"&lt;BR /&gt; dbms=xlsx&lt;BR /&gt; replace;&lt;BR /&gt; sheet=Demographics;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, conceptually what I am trying to do is this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc export data=lib.FreqGender outfile="&amp;amp;ProjPath\V005.xlsx"&lt;BR /&gt; dbms=xlsx&lt;BR /&gt; replace;&lt;BR /&gt; sheet=Demographics;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;range=gender;&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i.e. I have defined a cell range called gender in the sheet called demographics, where I want to export the contents of the SAS dataset called FreqGender. &amp;nbsp;Any ideas ?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 14:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227858#M41098</guid>
      <dc:creator>alan0101</dc:creator>
      <dc:date>2015-09-30T14:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset to a Range on an Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227864#M41099</link>
      <description>&lt;P&gt;I have seen something online about range names but never when related to export, only import so I'm not able to help there.&amp;nbsp; If you give the actual range it should work though.&amp;nbsp; Range like this 'range =Sheet1!C1:E8'&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 15:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227864#M41099</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-09-30T15:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset to a Range on an Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227866#M41100</link>
      <description>&lt;P&gt;Are you talking about a named range?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so if you use a libname to access the sheet you can write to the sheet, first drop it and then set it. However, I don't believe this works with the XLSX engine. If you're using the XLSX engine you'll need to specify the range as a range of cells, like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30712"&gt;@Steelers_In_DC﻿&lt;/a&gt;&amp;nbsp;has specified.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname test pcfiles path= 'path to excel file';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;drop table test.gender;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test.gender;&lt;/P&gt;
&lt;P&gt;set lib.freqgender;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname test;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2015 15:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/227866#M41100</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-30T15:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export SAS dataset to a Range on an Excel Spreadsheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/228165#M41184</link>
      <description>&lt;P&gt;I would use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname xl Excel "&amp;amp;ProjPath\V005.xlsx";

proc sql;
drop table xl.gender;
create table xl.gender as
select * from lib.FreqGender;
quit;

libname xl clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your named range will include column names on the first line. This works because dropping a table in Excel deletes the content but not the named range itself.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2015 03:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-SAS-dataset-to-a-Range-on-an-Excel-Spreadsheet/m-p/228165#M41184</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-02T03:57:53Z</dc:date>
    </item>
  </channel>
</rss>

