<?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 Import only specified rows columns from excel sheet in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843403#M82248</link>
    <description>&lt;P&gt;if I have an excel file looks like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2022-11-09 at 11.07.59 AM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77126i028055AE292F2874/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-11-09 at 11.07.59 AM.png" alt="Screenshot 2022-11-09 at 11.07.59 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use proc import detafile=.......... out=projoct_data;&lt;/P&gt;&lt;P&gt;and have a table like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 976px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77128i8F80F3974434090A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I fix it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, I want to row 2 in excel to become the name of data in the sas table, not F6,7,8,9...&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 09 Nov 2022 16:14:21 GMT</pubDate>
    <dc:creator>wfiona020</dc:creator>
    <dc:date>2022-11-09T16:14:21Z</dc:date>
    <item>
      <title>Import only specified rows columns from excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843403#M82248</link>
      <description>&lt;P&gt;if I have an excel file looks like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2022-11-09 at 11.07.59 AM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77126i028055AE292F2874/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-11-09 at 11.07.59 AM.png" alt="Screenshot 2022-11-09 at 11.07.59 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use proc import detafile=.......... out=projoct_data;&lt;/P&gt;&lt;P&gt;and have a table like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture.PNG" style="width: 976px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77128i8F80F3974434090A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How could I fix it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moreover, I want to row 2 in excel to become the name of data in the sas table, not F6,7,8,9...&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 16:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843403#M82248</guid>
      <dc:creator>wfiona020</dc:creator>
      <dc:date>2022-11-09T16:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Import only specified rows columns from excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843415#M82249</link>
      <description>&lt;P&gt;Show the actual CODE you used to read the excel file.&lt;/P&gt;
&lt;P&gt;Do you actually have an XLSX file?&amp;nbsp; Or did you accidentally let Excel open a CSV file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have an XLSX file then use the RANGE statement to tell it start in cell A2 instead of A1.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; range='$A2:';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fname = %sysfunc(pathname(work))/class.xlsx;

proc export data=sashelp.class file="&amp;amp;fname" dbms=xlsx replace;
run;

proc import file="&amp;amp;fname" dbms=xlsx out=test1 replace;
run;

proc import file="&amp;amp;fname" dbms=xlsx out=test2 replace;
  range='$A2:';
  getnames=NO;
run;

proc compare data=test1 compare=test2;
  var name sex age height weight;
  with a b c d e;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a CSV file then skip the PROC IMPORT and write your own data step to read it.&amp;nbsp; Use the FIRSTOBS=3 option on the INFILE statement to skip both header lines.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 16:46:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843415#M82249</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-09T16:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import only specified rows columns from excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843422#M82250</link>
      <description>It’s xlsx , not csv.&lt;BR /&gt;How can I change name too?&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Nov 2022 17:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843422#M82250</guid>
      <dc:creator>wfiona020</dc:creator>
      <dc:date>2022-11-09T17:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Import only specified rows columns from excel sheet</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843424#M82251</link>
      <description>To get the names, use GETNAMES=YES or leave that option out and just specify the range starts at A2. If you know the ending of the range of data and this is a one time import it's sometimes useful to specify the end of the range, ie A2:J28</description>
      <pubDate>Wed, 09 Nov 2022 17:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Import-only-specified-rows-columns-from-excel-sheet/m-p/843424#M82251</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-11-09T17:23:02Z</dc:date>
    </item>
  </channel>
</rss>

