<?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 can I import two parts from Excel file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104088#M21733</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl Excel "path to your file.xls" GETNAMES=NO;&lt;/P&gt;&lt;P&gt;data whole;&lt;/P&gt;&lt;P&gt;set xl.'Sheet1$A1:Z50'n, xl.'Sheet1$A60:Z100'n;&lt;/P&gt;&lt;P&gt;id='path to your file.xls';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Oct 2012 18:52:22 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2012-10-23T18:52:22Z</dc:date>
    <item>
      <title>How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104084#M21729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are graphs mixed in my excel file. I need to create a sas dateset from A1 to Z50&amp;nbsp; and from A60 to Z100 of the excel file. How can I do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 18:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104084#M21729</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-23T18:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104085#M21730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Couldn't you just do two imports, using the range option, and then concatenate the two files that you create?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example of using the range option is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;PROC IMPORT OUT= WORK.PART1&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAFILE= "c:\xltest.xls"&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS=EXCEL2000 REPLACE;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RANGE="A15:C17";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=NO;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 18:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104085#M21730</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-10-23T18:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104086#M21731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC IMPORT OUT= WORK.out &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAFILE= "C:\Users\admin\Desktop\Book1.xls" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS=EXCEL REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RANGE="Sheet1$A1:Z50"; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=No;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MIXED=NO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTEXT=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; USEDATE=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SCANTIME=YES;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Same above with changes in the range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 18:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104086#M21731</guid>
      <dc:creator>bnarang</dc:creator>
      <dc:date>2012-10-23T18:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104087#M21732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Art!&amp;nbsp; That is what I am doing now. I thought maybe we can get the two parts with one pass. Also, I need to add a variable&amp;nbsp; id="name of the excel file". Do I need another data step to get that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 18:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104087#M21732</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-23T18:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104088#M21733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl Excel "path to your file.xls" GETNAMES=NO;&lt;/P&gt;&lt;P&gt;data whole;&lt;/P&gt;&lt;P&gt;set xl.'Sheet1$A1:Z50'n, xl.'Sheet1$A60:Z100'n;&lt;/P&gt;&lt;P&gt;id='path to your file.xls';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 18:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104088#M21733</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-10-23T18:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104089#M21734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you PG!!! It works great!&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp;&amp;nbsp; We need to take out the extra "&lt;SPAN style="color: #ff0000;"&gt;,&lt;/SPAN&gt;" in &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px; background-color: #ffffff;"&gt;set xl.'Sheet1$A1:Z50'n&lt;SPAN style="color: #ff0000;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #ffff00;"&gt;,&lt;/SPAN&gt; xl.'Sheet1$A60:Z100'n;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 19:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104089#M21734</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-23T19:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104090#M21735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="3068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; Definitely liked PG's solution.&amp;nbsp; If you only want the filename, rather than the full path, you could add to his code to do something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl Excel "c:\art\linlintest.xls" GETNAMES=NO;&lt;/P&gt;&lt;P&gt;%let fullpath = %sysfunc(pathname(xl));&lt;/P&gt;&lt;P&gt;data whole;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length filename $50.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain filename;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set xl.'Sheet1$A7:c8'n xl.'Sheet1$A14:c15'n INDSNAME=variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then filename=substr("&amp;amp;fullpath.",findc("&amp;amp;fullpath.","\",'b',1)+1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xl clear;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 21:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104090#M21735</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-10-23T21:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I import two parts from Excel file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104091#M21736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Art! It turned out that the rows I need are different from file to file.&amp;nbsp; I added something like below after importing the entire file :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set &amp;amp;dsn;&lt;/P&gt;&lt;P&gt;&amp;nbsp; n=_n_;&lt;/P&gt;&lt;P&gt;data _dull_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if upcase(compress(f1))="&amp;amp;cell";&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('c2',_n_);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let n1=%eval(&amp;amp;c2+1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let n2=%eval(&amp;amp;c2+6);&lt;/P&gt;&lt;P&gt; data c2test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where n between &amp;amp;n1 and &amp;amp;n2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 02:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-import-two-parts-from-Excel-file/m-p/104091#M21736</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-10-24T02:13:52Z</dc:date>
    </item>
  </channel>
</rss>

