<?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: proc import xlsx secific row in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592355#M18112</link>
    <description>&lt;P&gt;first of all this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3" style="box-sizing: inherit; color: #0000ff; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; = sheet1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;should be&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3" style="box-sizing: inherit; color: #0000ff; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;sheet&lt;/FONT&gt; = "sheet1";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2019 23:54:06 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2019-09-27T23:54:06Z</dc:date>
    <item>
      <title>proc import xlsx secific row</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592343#M18111</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; I am trying to import data from an excel file that looks similar to the below screenshot and attached file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data starts in row 13 (which I was able to get), and column names to be from column 5 (not row 1) which I was not able to get.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current code:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"/foldername/sample1.xlsx"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbms&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = xlsx&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = outfile.sample1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;replace&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;getnames&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;= no;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datarow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;= &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;13&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;namerow&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = sheet1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current Error:&lt;/P&gt;
&lt;P&gt;27 dbms = xlsx&lt;/P&gt;
&lt;P&gt;28 out = out.sample1 replace;&lt;/P&gt;
&lt;P&gt;NOTE: The previous statement has been deleted.&lt;/P&gt;
&lt;P&gt;29 getnames= no;&lt;/P&gt;
&lt;P&gt;30 datarow= 13;&lt;/P&gt;
&lt;P&gt;31 namerow=5;&lt;/P&gt;
&lt;P&gt;_______&lt;/P&gt;
&lt;P&gt;180&lt;/P&gt;
&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;
&lt;P&gt;32 sheet = sheet1;&lt;/P&gt;
&lt;P&gt;33 run;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. How can i fix this error and get column names in SAS to be&amp;nbsp; from row 5 of the excel file?&lt;/P&gt;
&lt;P&gt;2. Row 6 contains some description about the vriables, how can I convert that into a "Label" in SAS during or after&lt;/P&gt;
&lt;P&gt;importing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached my sample data below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 322px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32793iB30C1E5D8637641E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 23:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592343#M18111</guid>
      <dc:creator>ubshams</dc:creator>
      <dc:date>2019-09-27T23:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc import xlsx secific row</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592355#M18112</link>
      <description>&lt;P&gt;first of all this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3" style="box-sizing: inherit; color: #0000ff; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;sheet&lt;/FONT&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; = sheet1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;should be&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3" style="box-sizing: inherit; color: #333333; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3" style="box-sizing: inherit; color: #0000ff; font-family: Courier New; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;sheet&lt;/FONT&gt; = "sheet1";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 23:54:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592355#M18112</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-09-27T23:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: proc import xlsx secific row</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592356#M18113</link>
      <description>&lt;P&gt;You can read the documentation on PROC IMPORT of Excel spreadsheets here: &lt;A href="https://documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note the options that are available to you if you use DBMS = XLSX. They are GETNAMES, RANGE and SHEET only. DATAROW and NAMEROW are not valid for importing spreadsheets at all. I'm guessing you picked these up from DBMS = CSV or similar.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2019 00:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592356#M18113</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-09-28T00:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: proc import xlsx secific row</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592428#M18121</link>
      <description>&lt;P&gt;Excel data unfortunately is very susceptible to being moved around, cell characteristics changing, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My solution is to always import the entire worksheet, and then using base code edit both the cells that I expect to contain data, to ensure the contents are reasonable, and to ensure there's nothing I don't expect in the other cells. Otherwise, you're likely to keep processing worksheets and producing results, even when the cells no longer line up the way they should.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2019 21:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592428#M18121</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-09-28T21:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: proc import xlsx secific row</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592447#M18125</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185449"&gt;@ubshams&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In case you don't need to implement a repetitive process but you just need to read this specific Excel sheet into SAS: I wouldn't bother to write code which can read this messy structure but I would modify the structure so that it's easy to read.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you could do:&lt;/P&gt;
&lt;P&gt;1. copy the sheet&lt;/P&gt;
&lt;P&gt;2. get rid of all unwanted rows; have the column headers in row 1 and the data starting in row 2&lt;/P&gt;
&lt;P&gt;3. store the sheet as .csv&lt;/P&gt;
&lt;P&gt;4. eventually use the EG import wizard to generate the SAS code for reading the .csv&lt;/P&gt;
&lt;P&gt;5. modify the generated code as you see fit (i.e. add a label statement, modify formats to whatever you want).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here the EG generated code reading the attached .csv created from your sample Excel data.&lt;/P&gt;
&lt;P&gt;I've already added a label statement as well.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.sample;
  LENGTH
    m2                 8
    xyz1               8
    xyz2               8
    xyz3               8
  ;
  FORMAT
    m2               DATE9.
    xyz1             BEST6.
    xyz2             BEST6.
    xyz3             BEST4.
  ;
  INFORMAT
    m2               DATE9.
    xyz1             BEST6.
    xyz2             BEST6.
    xyz3             BEST4.
  ;
  label 
    m2='some label'
  ;
  INFILE '/foldername/sample1_csv.csv'
    DLM=';'
    MISSOVER
    DSD;
  INPUT
    m2               : ?? DATE9.
    xyz1             : ?? COMMA6.
    xyz2             : ?? COMMA6.
    xyz3             : ?? COMMA4.
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Sep 2019 23:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/proc-import-xlsx-secific-row/m-p/592447#M18125</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-28T23:58:03Z</dc:date>
    </item>
  </channel>
</rss>

