<?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: Importing Excel Files with namerow and range options in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246736#M6518</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Is this a one time thing?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If so, create a named range instead of a cell range and it works. Not sure why it doesn't work with a cell range.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Doesn't work*/
proc import out=want datafile='C:\_localdata\delete.xlsx' dbms=xlsx replace; range='A2:C6'; sheet='Sheet1';getnames=yes;
run;


/*Named range in Excel, Does work*/
proc import out=want datafile='C:\_localdata\delete.xlsx' dbms=xlsx replace; range='Input1';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 Jan 2016 20:10:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-28T20:10:20Z</dc:date>
    <item>
      <title>Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246709#M6514</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to import an excel sheet that has the field names in the second row and the data begins in the 3rd. Further, I need to import only a certain range. The following code gives me an error if I use the range:&lt;/P&gt;
&lt;P&gt;PROC IMPORT OUT = NEW &amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;DATAFILE= "F:\data.xls" &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBMS=XLS REPLACE; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;SHEET="Data"; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RANGE="A2:GF332";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;NAMEROW=2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;DATAROW=3;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;GETNAMES=YES;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use the .XLSX format file I can use the range option, but not the NAMEROW option. How do I get both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Sarah&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 18:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246709#M6514</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2016-01-28T18:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246728#M6516</link>
      <description>&lt;P&gt;According to the documentation:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you specify a range and GETNAMES=YES then the first row of the range is used to construct the column names and the second row is where the data starts. So NAMEROW and DATAROW become redundant in this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your sheet import correctly and do column names get assigned correctly using just RANGE and GETNAMES?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 19:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246728#M6516</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-01-28T19:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246729#M6517</link>
      <description>&lt;P&gt;You would think that by specifying the range (which would exclude the first row), using the range and getnames options would work,but it does not. When I comment out the datarow and namerow options, it pulls the first row in for the names.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2016 19:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246729#M6517</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2016-01-28T19:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246736#M6518</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Is this a one time thing?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If so, create a named range instead of a cell range and it works. Not sure why it doesn't work with a cell range.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Doesn't work*/
proc import out=want datafile='C:\_localdata\delete.xlsx' dbms=xlsx replace; range='A2:C6'; sheet='Sheet1';getnames=yes;
run;


/*Named range in Excel, Does work*/
proc import out=want datafile='C:\_localdata\delete.xlsx' dbms=xlsx replace; range='Input1';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jan 2016 20:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246736#M6518</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-28T20:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246814#M6521</link>
      <description>&lt;P&gt;Use RANGE= instead of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NAMEROW=2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DATAROW=3;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import out=want datafile='/folders/myfolders/adae.xlsx' dbms=xlsx replace; 
range='Sheet1$A10:D20';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Jan 2016 01:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/246814#M6521</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-29T01:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel Files with namerow and range options</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/351301#M10435</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;wrote:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to the documentation:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm" target="_blank" rel="nofollow noopener noreferrer"&gt;http://support.sas.com/documentation/cdl/en/acpcref/67382/HTML/default/viewer.htm#n0msy4hy1so0ren1ac...&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you specify a range and GETNAMES=YES then the first row of the range is used to construct the column names and the second row is where the data starts. So NAMEROW and DATAROW become redundant in this case.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively,&lt;/P&gt;
&lt;P&gt;you could specify a &lt;A href="https://exceljet.net/named-ranges" target="_blank"&gt;"named range"&lt;/A&gt; in Excel (open your workbook and hold CTRL+F3, then click new... select a region and enter a name)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*import the whole sheet*/
PROC IMPORT datafile="C:\TEMP\workbook.xlsx" 
   OUT=want
   DBMS=XLSX REPLACE ;
   SHEET="...yourSheetName...";
   GETNAMES=YES;
RUN;

/*import a named range*/
PROC IMPORT datafile="C:\TEMP\workbook.xlsx" 
   OUT=want
   DBMS=XLSX REPLACE ;
   RANGE="...yourNamedRange...";
   GETNAMES=NO;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 12:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-Excel-Files-with-namerow-and-range-options/m-p/351301#M10435</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2017-05-08T12:13:26Z</dc:date>
    </item>
  </channel>
</rss>

