<?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: How to specify a range for an Excel file with proc import where you only know the starting cell? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667582#M199940</link>
    <description>It will depend on the structure of your data.</description>
    <pubDate>Tue, 07 Jul 2020 21:33:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-07-07T21:33:18Z</dc:date>
    <item>
      <title>How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667546#M199921</link>
      <description>&lt;P&gt;I'm trying to import a series of files in a macro where the only constant is that the data starts at cell B9 of Sheet1. What is the syntax for only specifying one part of the range?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = "path/filename.xlsx"
			out = want
			dbms = xlsx replace;
			range = "Sheet1$B9:";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have tried the above but that returns an error.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 19:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667546#M199921</guid>
      <dc:creator>Ani7</dc:creator>
      <dc:date>2020-07-07T19:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667548#M199923</link>
      <description>&lt;P&gt;Try using 0 as the end where it will default to the full range available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = "path/filename.xlsx"
			out = want
			dbms = xlsx replace;
			range = "Sheet1$B9:0";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223871"&gt;@Ani7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to import a series of files in a macro where the only constant is that the data starts at cell B9 of Sheet1. What is the syntax for only specifying one part of the range?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = "path/filename.xlsx"
			out = want
			dbms = xlsx replace;
			range = "Sheet1$B9:";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have tried the above but that returns an error.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;Moderator note: See also this alternative from&lt;/EM&gt;&amp;nbsp;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;:&lt;/EM&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Alternatively, you can use a LIBNAME statement, such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;libname xl xlsx " ..... /b9test.xlsx";

proc sql;
create table want1 as
select name, id
from xl.'Sheet1$B9:'n;
quit;

/* Or */
data want2;
set xl.'Sheet1$B9:'n;
run;

/* Or, read directly into any proc */
proc print data=xl.'Sheet1$B9:'n noobs; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It all works for me on SAS release: 9.04.01M6P110718&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 05 Sep 2022 19:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667548#M199923</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-09-05T19:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667549#M199924</link>
      <description>&lt;P&gt;Unfortunately, that doesn't work and returns the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR:  An exception has been encountered.
Please contact technical support and provide them with the following traceback information:
 
The SAS task name is [IMPORT (]
Segmentation Violation
 
Traceback of the Exception:
 
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sas(+0x15aa6e) [0x564e723c8a6e]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sas(+0x4cb0b) [0x564e722bab0b]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/tkmk.so(bkt_signal_handler+0x144) [0x2af039c323c4]
/lib64/libpthread.so.0(+0xf630) [0x2af038aeb630]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimxlx(+0x187a9) [0x2af091f587a9]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimxlx(+0x14f83) [0x2af091f54f83]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimxlx(dbmscopy_read_header+0x94) [0x2af091f4d6c4]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimxlx(getvars+0xa) [0x2af091f4890a]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimctr(cpfdata+0x7c) [0x2af091d28ffc]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimctr(import+0x609) [0x2af091d28a79]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimctr(parsexe+0x24b) [0x2af091d27adb]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sasimpor(sasimpor+0x1a8) [0x2af091b10d28]
/gpfs/grid/sas/sashome/SASFoundation/9.4/sasexe/sas(vvtentr+0x13d) [0x564e722ba6ad]
/lib64/libpthread.so.0(+0x7ea5) [0x2af038ae3ea5]
/lib64/libc.so.6(clone+0x6d) [0x2af0395338cd]&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 19:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667549#M199924</guid>
      <dc:creator>Ani7</dc:creator>
      <dc:date>2020-07-07T19:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667555#M199927</link>
      <description>You can use RANGE= to specify the row number where PROC IMPORT starts to read data. Set the end point to “0”, and the code then determines the last row and last column. Specify RANGE="Sheetname$A#:0"; where # is the first data row. Thus, RANGE="sheet1$A3:0"; starts to read the data at row 3. If you use RANGE= for this purpose, do not specify the DATAROW= statement.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p09degjribu2smn1eaqt5eq9on58" target="_blank"&gt;https://go.documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p09degjribu2smn1eaqt5eq9on58&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I would suggest restarting and trying it again. Not sure that issue is related to your import and not something else, otherwise show your code.</description>
      <pubDate>Tue, 07 Jul 2020 19:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667555#M199927</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-07T19:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667556#M199928</link>
      <description>&lt;P&gt;What error are you getting?&amp;nbsp;The code you included works for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;test.xlsx:&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mklangley_0-1594151574363.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46983iDC986162EAF078C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mklangley_0-1594151574363.png" alt="mklangley_0-1594151574363.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile = "path/test.xlsx"
			out = want
			dbms = xlsx replace;
			range = "Sheet1$B9:";
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mklangley_1-1594151603378.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46984i5B0F8EB2F7B2E9D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mklangley_1-1594151603378.png" alt="mklangley_1-1594151603378.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 19:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667556#M199928</guid>
      <dc:creator>mklangley</dc:creator>
      <dc:date>2020-07-07T19:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667580#M199939</link>
      <description>&lt;P&gt;Alternatively, you can use a LIBNAME statement, such as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname xl xlsx " ..... /b9test.xlsx";

proc sql;
create table want1 as
select name, id
from xl.'Sheet1$B9:'n;
quit;

/* Or */
data want2;
set xl.'Sheet1$B9:'n;
run;

/* Or, read directly into any proc */
proc print data=xl.'Sheet1$B9:'n noobs; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It all works for me on SAS release: 9.04.01M6P110718&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 21:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667580#M199939</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-07-07T21:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify a range for an Excel file with proc import where you only know the starting cell?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667582#M199940</link>
      <description>It will depend on the structure of your data.</description>
      <pubDate>Tue, 07 Jul 2020 21:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-a-range-for-an-Excel-file-with-proc-import-where/m-p/667582#M199940</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-07T21:33:18Z</dc:date>
    </item>
  </channel>
</rss>

