<?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: Proc Import Excel File with data in second row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/322057#M71204</link>
    <description>&lt;P&gt;Nope, its still not working. It doesn't matter what I do, it keeps on taking the first row (the one I want to ignore) as the variable names. Log window gives no errors or notes. The range statement makes no difference. If I comment out the range stament with the datarow statement in, I can either get the variable names in as the first row, or exclude it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"C:\temp\book3b.xlsx"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= Test_Data replace&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= XLSX;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Test Data"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;getnames&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= yes;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/* datarow=2;*/&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;range&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Test Data$A2:0"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I can go the log way around and import it like this with the variable names in the first row, and then somehow create a new dataset from this....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GD&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13295iBC53734A2D9C2605/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="book3b.PNG" title="book3b.PNG" /&gt;</description>
    <pubDate>Tue, 03 Jan 2017 03:45:02 GMT</pubDate>
    <dc:creator>GenDemo</dc:creator>
    <dc:date>2017-01-03T03:45:02Z</dc:date>
    <item>
      <title>Proc Import Excel File with data in second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321513#M71017</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an Excel file that I need to import from another team to SAS. Usually I would save it as a CSV and import using a data step with an infile statement. But for various reasons i don't want to do that for this particular excersice - I need to import the Excel file directly. Please see attached an example of the file structure. The first row is a heading that I want to skip, with the variable names in the second row and the data from there on.&lt;/P&gt;
&lt;P&gt;I looked on the forum and for some reason the code that people suggest to do this, gives me an error. When I try and run the code below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile= "C:\temp\book3b.xlsx"
	out= Test_Data replace
	DBMS= Excel;
	sheet= "Test Data";
/*	startrow=3;*/
/*	namerow=2;*/
	getnames= yes;
/*	mixed=yes;*/
/*	scantext=yes;*/
/*	usedate=yes;*/
	datarow=3;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get "ERROR 180-322: Statement is not valid or it is used out of proper order." on the 'datarow' line.&lt;/P&gt;
&lt;P&gt;1) How can I ignore the first row?&lt;/P&gt;
&lt;P&gt;2) is there a way i can tell the import procedure I want to exclude certain columns? The 'Comments' column has a high potential to give errors and inconsistancies, and as such i would just like to ignore it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thnx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GD&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2016 02:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321513#M71017</guid>
      <dc:creator>GenDemo</dc:creator>
      <dc:date>2016-12-29T02:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Excel File with data in second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321521#M71024</link>
      <description>&lt;P&gt;Try DBMS=XLSX and DATAROW=3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I couldn't get it to work with GETNAMES and DATAROW though.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2016 03:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321521#M71024</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-29T03:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Excel File with data in second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321523#M71025</link>
      <description>&lt;P&gt;Helpful little note in the documentation, which did work as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/acpcref/69731/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/acpcref/69731/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Specify RANGE="&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;Sheetname&lt;/SPAN&gt;&lt;SPAN&gt;$A#:0"; where&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="xis-userSuppliedValue"&gt;#&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is the first data row. Thus,&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="xis-codeDefaultStyle"&gt;RANGE="sheet1$A3:0";&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;starts to read the data at row 3. If you use RANGE= for this purpose, do not specify the DATAROW= statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import out=test datafile='/folders/myfolders/input.xlsx' dbms=xlsx replace; getnames=yes;
range="Sheet1$A2:0";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Dec 2016 03:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/321523#M71025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-29T03:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Excel File with data in second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/322057#M71204</link>
      <description>&lt;P&gt;Nope, its still not working. It doesn't matter what I do, it keeps on taking the first row (the one I want to ignore) as the variable names. Log window gives no errors or notes. The range statement makes no difference. If I comment out the range stament with the datarow statement in, I can either get the variable names in as the first row, or exclude it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"C:\temp\book3b.xlsx"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= Test_Data replace&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= XLSX;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Test Data"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;getnames&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= yes;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/* datarow=2;*/&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;range&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Test Data$A2:0"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I can go the log way around and import it like this with the variable names in the first row, and then somehow create a new dataset from this....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GD&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13295iBC53734A2D9C2605/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="book3b.PNG" title="book3b.PNG" /&gt;</description>
      <pubDate>Tue, 03 Jan 2017 03:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/322057#M71204</guid>
      <dc:creator>GenDemo</dc:creator>
      <dc:date>2017-01-03T03:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import Excel File with data in second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/322060#M71207</link>
      <description>&lt;P&gt;ah...the sheet statement with the range statement confuses the thing. Silly that it doesn't give you an error or a note on this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"C:\temp\book3b.xlsx"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= Test_Data replace&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DBMS&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= XLSX;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/* sheet= "Test Data";*/&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;getnames&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;= yes;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/* datarow=2;*/&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;range&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"Test Data$A2:0"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 04:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Import-Excel-File-with-data-in-second-row/m-p/322060#M71207</guid>
      <dc:creator>GenDemo</dc:creator>
      <dc:date>2017-01-03T04:02:17Z</dc:date>
    </item>
  </channel>
</rss>

