<?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: Import multiple sheets form excel in SAS and append in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231812#M16836</link>
    <description>&lt;P&gt;Hi Anna,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a simple way using macro to determine the Sheet you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do the following example do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro pim(sheet);
proc import out= payment
    datafile = 'E:\SAS DOC\project\Credit Banking.xls'
    dbms = Excel;
    sheet = "&amp;amp;sheet";
    getnames = yes;
run;
%mend piim;
%pim(Customer Acqusition);
%pim(Spend);
%pim(Repayment);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps&amp;nbsp;&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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Att&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rodrigo Dartibali&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Oct 2015 13:28:09 GMT</pubDate>
    <dc:creator>DartRodrigo</dc:creator>
    <dc:date>2015-10-27T13:28:09Z</dc:date>
    <item>
      <title>Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231809#M16834</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using SAS Enterprise guide and I want to import multiple sheets from excel to SAS. In excel first sheet has column headers but other sheets don’t have column headers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I want to import all the sheets at the same time in SAS then append all in one append to the first dataset created form sheet1 as it has column headers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found something on the web so I tried using following code but library is not getting assigned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LibName xlsLib ‘H:\Pneumonia.xls’;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting error:&lt;/P&gt;
&lt;P&gt;ERROR: Connect: Class not registered&lt;/P&gt;
&lt;P&gt;ERROR: Error in the LIBNAME statement.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 13:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231809#M16834</guid>
      <dc:creator>AnnaShami</dc:creator>
      <dc:date>2015-10-27T13:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231812#M16836</link>
      <description>&lt;P&gt;Hi Anna,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a simple way using macro to determine the Sheet you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do the following example do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro pim(sheet);
proc import out= payment
    datafile = 'E:\SAS DOC\project\Credit Banking.xls'
    dbms = Excel;
    sheet = "&amp;amp;sheet";
    getnames = yes;
run;
%mend piim;
%pim(Customer Acqusition);
%pim(Spend);
%pim(Repayment);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps&amp;nbsp;&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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Att&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rodrigo Dartibali&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 13:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231812#M16836</guid>
      <dc:creator>DartRodrigo</dc:creator>
      <dc:date>2015-10-27T13:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231813#M16837</link>
      <description>&lt;P&gt;Well, do you have the required SAS/ACCESS license? &amp;nbsp;Run proc setinit. &amp;nbsp;You can try the libname excel statement, described;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi31/024-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/024-31.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its easy enough to work with. &amp;nbsp;What I would say however, is all your data the same on all the sheets, Excel is not a structured format, hence if you have mix of chars/numbers, specials, dates are always tricky, you are going to have difficulties. &amp;nbsp;Personally I would get the data in &amp;nbsp;proper data transfer format and have an agreement with the vendor of what is supplied.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 13:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231813#M16837</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-10-27T13:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231815#M16838</link>
      <description>&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note only first sheet has variable names on the top and other sheets don’t. So when I import each sheet separate, 2/3/4 sheets will have variables as A, B, C after they get imported in SAS…if I do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;getnames = no;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1" face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;And then append is a problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on the other hand if I have getnames = yes; first row will be displayed as varaible names..that's also a problem in appending all these sheets together in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 13:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231815#M16838</guid>
      <dc:creator>AnnaShami</dc:creator>
      <dc:date>2015-10-27T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231821#M16840</link>
      <description>&lt;P&gt;Anna, So for the sheet that does not contain the column names try&amp;nbsp;this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro pim(sheet,start,namerow);
proc import out= payment
    datafile = 'E:\SAS DOC\project\Credit Banking.xls'
    dbms = Excel;
    startrow=&amp;amp;start;
    namerow=&amp;amp;namerow.;
    sheet = "&amp;amp;sheet";
    getnames = yes;
run;
%mend piim;
%pim(Customer Acqusition,2,3);
%pim(Spend,1,1);
%pim(Repayment,1,1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Att&lt;/P&gt;</description>
      <pubDate>Tue, 27 Oct 2015 14:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/231821#M16840</guid>
      <dc:creator>DartRodrigo</dc:creator>
      <dc:date>2015-10-27T14:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339733#M22552</link>
      <description>&lt;P&gt;Outstanding! Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 18:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339733#M22552</guid>
      <dc:creator>ira_jacobson_delta_com</dc:creator>
      <dc:date>2017-03-09T18:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339753#M22553</link>
      <description>&lt;P&gt;How is this outstanding, the thread is from 2015, please avoid necro'ing posts.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 19:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339753#M22553</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-09T19:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339759#M22557</link>
      <description>&lt;P&gt;What is "necro'ing"? I'm sorry, I'm new here. I learned from this code what I needed to do and it worked. It was very helpful and to me, "Outstanding". What's the issue? I'm sorry, I do not understand.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 19:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339759#M22557</guid>
      <dc:creator>ira_jacobson_delta_com</dc:creator>
      <dc:date>2017-03-09T19:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple sheets form excel in SAS and append</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339760#M22558</link>
      <description>&lt;P&gt;To necro a post is to raise it from the dead. &amp;nbsp;This thread is from 2015, it is very old. &amp;nbsp;Posting again to an old thread raises it back up to the forefront, I for instance know this because I get automatic emails from posts I have contributed to, so as you can imagine, if people starting posting in all old posts, my email would collapse. &amp;nbsp;You can show your apreciation to posts by clicking the Like button below the post.&lt;/P&gt;
&lt;P&gt;Also note that old posts my not use current thinking/technology. &amp;nbsp;For instance if you are using an XLSX file, and have SAS 9.4 then you can far simpler access data by using the libname excel engine:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/" target="_blank"&gt;http://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 19:44:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-sheets-form-excel-in-SAS-and-append/m-p/339760#M22558</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-09T19:44:29Z</dc:date>
    </item>
  </channel>
</rss>

