<?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: importing from Excel in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497170#M131682</link>
    <description>&lt;P&gt;If the names are not in the first row then you need to import without names and add the names back later.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Sep 2018 22:11:20 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-09-19T22:11:20Z</dc:date>
    <item>
      <title>importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497130#M131655</link>
      <description>&lt;P&gt;I am importing an Excel file into 9.4 using the wizard but need the data to start at line 3 (total 377 lines) and to keep variables in line 1.&amp;nbsp; I cannot seem to get it to do no matter what.&amp;nbsp; Help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 20:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497130#M131655</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T20:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497150#M131667</link>
      <description>Yeah, I don't think SAS currently supports data in that style. You can import the data set and then drop the first two records easily enough though after.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Sep 2018 21:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497150#M131667</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-19T21:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497151#M131668</link>
      <description>&lt;P&gt;well how do you drop row 2 because nothing I have done works.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 21:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497151#M131668</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T21:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497163#M131678</link>
      <description>&lt;P&gt;Are you saying that your Excel file looks like:&lt;/P&gt;
&lt;PRE&gt;Name1 Name2
junk row
val1 val2
val3 val4
val5 val6&lt;/PRE&gt;
&lt;P&gt;To drop that extra row just add a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have (firstobs=2);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course the extra row of junk might mess up the SAS's ability to properly define the variable types.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 21:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497163#M131678</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-19T21:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497164#M131679</link>
      <description>If only, but it is not working. The program below is what I have to work with and datarow=3, firstobs=3, 3n, specifying a range and using getnames=yes - nothing worked.&lt;BR /&gt;&lt;BR /&gt;PROC IMPORT OUT= work.test1a&lt;BR /&gt;DATAFILE= "C:\Users\knorwoo1\Documents\My SAS Files\9.4\BIOE&lt;BR /&gt;813\test1\Test1A.xls"&lt;BR /&gt;DBMS=XLS REPLACE;&lt;BR /&gt;GETNAMES=YES;&lt;BR /&gt;RANGE="Sheet1$";&lt;BR /&gt;SCANTEXT=YES;&lt;BR /&gt;USEDATE=YES;&lt;BR /&gt;SCANTIME=YES;&lt;BR /&gt;RUN;&lt;BR /&gt;proc print;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Sep 2018 21:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497164#M131679</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T21:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497167#M131680</link>
      <description>&lt;P&gt;1. Import file wiht proc import&lt;/P&gt;
&lt;P&gt;2. remove first two records. _n_ is a pseudorecord number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import..blah;

data want;
set imported;

if _n_&amp;lt; 3 then delete;

run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497167#M131680</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-19T22:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497169#M131681</link>
      <description>&lt;P&gt;What version of SAS are you using. What type of Excel file do you have?&amp;nbsp; Is it XLSX or some older format?&lt;/P&gt;
&lt;P&gt;How is you Excel sheet actually arranged?&amp;nbsp; Here is a normal sheet.&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Name1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Name2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Here is one with extra row in the table.&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Name1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Name2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Here is one with extra row before the table.&lt;/P&gt;
&lt;TABLE border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64" height="20"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="20"&gt;Name1&lt;/TD&gt;
&lt;TD&gt;Name2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="20" align="right"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="20" align="right"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made an XLSX file with those three sheets and copied the data to work.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname in xlsx 'c:\downloads\test3.xlsx';
proc copy inlib=in outlib=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is what they look like.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 180px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23396i03B08167FBFD2DCE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Does your file look like any of these?&amp;nbsp; If not what does it look like?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:09:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497169#M131681</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-19T22:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497170#M131682</link>
      <description>&lt;P&gt;If the names are not in the first row then you need to import without names and add the names back later.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497170#M131682</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-19T22:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497175#M131684</link>
      <description>They are in the first row but need to skip row two and start data at row 3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497175#M131684</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T22:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497176#M131685</link>
      <description>SAS 9.4 and xls&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Variable names are in row 1&lt;BR /&gt;&lt;BR /&gt;Gobble goop I want to skip in row 2&lt;BR /&gt;&lt;BR /&gt;Data begins row 3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:26:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497176#M131685</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T22:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497178#M131687</link>
      <description>But that deletes the variable names as well. If 1 &amp;lt;_n_ &amp;lt; 3 then delete; you think it will work?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATAROWS=3; should work but I don't know where it goes in the program as it rejected them all.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497178#M131687</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-19T22:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497184#M131691</link>
      <description>&lt;P&gt;If the names are in the first row then the only option you need is the datarow option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='c:\downloads\test3.xlsx' out=values replace dbms=xlsx ;
  sheet='Sheet4';
  datarow=3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What XLSX sheet looks like&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Name1&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Name2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;Junk&lt;/TD&gt;
&lt;TD&gt;Junk&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;What SAS dataset looks like&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 155px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23397iDFFF227F980E3CF6/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;NOTE: works the same using XLS file instead of XLSX file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 22:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497184#M131691</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-19T22:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497350#M131796</link>
      <description>That is what I thought but no. Error says bad command or used out of order&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Sep 2018 13:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497350#M131796</guid>
      <dc:creator>K3K</dc:creator>
      <dc:date>2018-09-20T13:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497356#M131799</link>
      <description>&lt;P&gt;Show your log use the {i} in editor menu bar to open pop-up window to paste the log contents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also exactly what version of SAS are you using?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there other issues with the XLS file that might cause trouble for SAS?&amp;nbsp; Merged cells for example?&lt;/P&gt;
&lt;P&gt;And if you can pare down the problem XLS file to a small example that still exhibits the issue then post that as an attachment.&amp;nbsp; Although most user of forum would be reluctant to download an XLS file from web.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 13:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497356#M131799</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-20T13:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: importing from Excel</title>
      <link>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497449#M131852</link>
      <description>&lt;P&gt;FWIW I routinely save any Excel file to CSV and work with that as there are more options in Proc Import, such as GUESSINGROWS and data rows. And even then usually modify the data step code generated to read the CSV to be "nicer" in providing useable variable names, consistent lengths if I expect to deal with multiple files in a similar layout, adding variable labels and even data checking code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Relying on proc import to deal with multiple files often leads to headaches if the data has to be combined later.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 16:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/importing-from-Excel/m-p/497449#M131852</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-20T16:18:28Z</dc:date>
    </item>
  </channel>
</rss>

