<?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: Reading an Excel file without using menu-driven &amp;quot;File....Import Data&amp;quot;? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89831#M25662</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi Art and &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="807594" data-objecttype="3" href="https://communities.sas.com/people/bentleyj1"&gt;bentleyj1&lt;/A&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank both of you again. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Both of your inputs are very useful. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the first time i heard about "Excel Libname Engine".&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Warm regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mirisage&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Aug 2012 13:23:10 GMT</pubDate>
    <dc:creator>Mirisage</dc:creator>
    <dc:date>2012-08-11T13:23:10Z</dc:date>
    <item>
      <title>Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89826#M25657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;Hi SAS Forum,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I need to read the attached Excel file into SAS but d&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;o not want to use the menu driven “File…..Import Data…” approach.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;I have made the below code by tweaking a recent Ksharp’s code and it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;import&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;datafile&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN lang="EN" style="color: #575757;"&gt;'c:\temp\post_this.xls'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=Arrears_History1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*sas file being created*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;dbms&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=xls &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*because my file is a CSV*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;replace&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/* in case I need to run this again*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;getnames&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=yes;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Question:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;The attached Excel file is just a very small sample of my original big file. So, I may not be able to detect any errors even if they happen. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;So, could any expert please let me know if this approach is correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Mirisage&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 12:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89826#M25657</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-08-10T12:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89827#M25658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use the menu driven import data approach, near the end of the process SAS asks you if you want to save the code and, if so, where.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have always found it useful to use the menu, select various options that appear related to whatever problem I was confronting, and then save the code so that I could use it as a template for solving similar needs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 13:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89827#M25658</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-10T13:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89828#M25659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because you're working on the desktop, you can use a LIBNAME statement with the Excel engine to handle the workbook like it was a SAS data set.&amp;nbsp; Because you're concerned about bad data, you could run a proc freq, means, or however you validate the data and then continue only if there are no problems.&amp;nbsp; Below is one approach you might consider.&amp;nbsp; (untested code)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're using SAS 9.1.3 the file must be xls.&amp;nbsp; 9.1.3 doesn't work with Office 2007's xlsx format.&amp;nbsp; You should flip thru the on-line documentation about the Excel libname enging first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname xls excel 'c:\temp\excel_file.xls';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** Count the number of problem records. ;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select count(*)&lt;/P&gt;&lt;P&gt;&amp;nbsp; into : _num_bad_records&lt;/P&gt;&lt;P&gt;&amp;nbsp; from xls.'sheet1$'n&lt;/P&gt;&lt;P&gt;&amp;nbsp; where check_this_field_value &amp;gt; 100;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** If there are more than X number of problem records then abort.&amp;nbsp; Must convert the character macro value to numeric. ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if input(put("&amp;amp;_num_bad_records",$3.)3.) &amp;gt; 5 then abort;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;** Otherwise continue with Normal processing. ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 15:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89828#M25659</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2012-08-10T15:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89829#M25660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi Art and &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="807594" data-username="bentleyj1" href="https://communities.sas.com/people/bentleyj1" id="jive-80759445114902251780803"&gt;bentleyj1&lt;/A&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank both of you.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Actually "Importing the Excel file" is just a one component of my code that I am preparing now. This import has to be automated into the code. So, nobody is manually &lt;/STRONG&gt;&lt;STRONG&gt;doing it.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I think as Art said, I can first do the menu driven "import data approach", and then get the code, and then embed that code piece into my large code, isn't it?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thnaks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mirisage&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 19:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89829#M25660</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-08-10T19:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89830#M25661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Myself, when I have something that runs unattended and there's a possiblity of data errors I do data validation and abort if appropriate.&amp;nbsp; I also build in error checking and abort if appropriate there too.&amp;nbsp; That way you don't waste time and resources processing crap.&amp;nbsp; When you said you were concerned about detecting errors, I thought that's what you were talking about.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sure just capture the proc import code and plug it in.&amp;nbsp; Lots of people do it that way.&amp;nbsp; But the Excel libname engine gives you much greater flexibility.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Aug 2012 21:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89830#M25661</guid>
      <dc:creator>bentleyj1</dc:creator>
      <dc:date>2012-08-10T21:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89831#M25662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Hi Art and &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="807594" data-objecttype="3" href="https://communities.sas.com/people/bentleyj1"&gt;bentleyj1&lt;/A&gt;,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank both of you again. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Both of your inputs are very useful. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the first time i heard about "Excel Libname Engine".&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Warm regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Mirisage&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Aug 2012 13:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89831#M25662</guid>
      <dc:creator>Mirisage</dc:creator>
      <dc:date>2012-08-11T13:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Excel file without using menu-driven "File....Import Data"?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89832#M25663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FWIW: I just added a suggestion to the SASWare ballot.&amp;nbsp; Isn't it about time that proc import and export, when providing the code that was generated, also return the code that could have been run using the libname/data step method?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Aug 2012 14:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-an-Excel-file-without-using-menu-driven-quot-File-Import/m-p/89832#M25663</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-11T14:23:07Z</dc:date>
    </item>
  </channel>
</rss>

