<?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: To import an Excel file into SAS with column headers on more than one line. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/805243#M317186</link>
    <description>Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Thank you for your Post!!&lt;BR /&gt;Using the below mentioned code I was able to read the Excel files with headers on Multiple rows, and I was working on renaming the columns as the excel sheet keeps growing and also calculating the sales percentages for all the years.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
    <pubDate>Thu, 31 Mar 2022 12:00:06 GMT</pubDate>
    <dc:creator>Santt0sh</dc:creator>
    <dc:date>2022-03-31T12:00:06Z</dc:date>
    <item>
      <title>Import an excel sheet which has the column header on two rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804647#M316887</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to read an excel file into SAS which has headers on two rows, I tried using the solutions provided here but I was not able to get the desired output.&lt;/P&gt;&lt;P&gt;I thought of reading the .xlsx file twice and assigning the variable names to the merged columns in excel but later realized that the excel sheet/dataset keeps growing for the upcoming months or years.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to transpose after importing the .xlsx file with GETNAME = NO OPTION.&lt;/P&gt;&lt;P&gt;Please find the excel attached, Kindly Suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 01:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804647#M316887</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-29T01:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Import an excel sheet which has the column header on two rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804648#M316888</link>
      <description>The transpose results.&lt;BR /&gt;Variable Name Variable Type&lt;BR /&gt;C 2&lt;BR /&gt;E 2&lt;BR /&gt;F 2&lt;BR /&gt;G 2&lt;BR /&gt;GRAND TOTAL 1&lt;BR /&gt;H 2&lt;BR /&gt;I 2&lt;BR /&gt;J 2&lt;BR /&gt;K 2&lt;BR /&gt;L 2&lt;BR /&gt;M 2&lt;BR /&gt;N 2&lt;BR /&gt;O 2&lt;BR /&gt;PROGRAM_TYPE 2&lt;BR /&gt;PRODUCT_TYPE 2&lt;BR /&gt;R 2&lt;BR /&gt;S 2&lt;BR /&gt;T 2&lt;BR /&gt;U 2&lt;BR /&gt;V 2&lt;BR /&gt;W 2&lt;BR /&gt;X 2&lt;BR /&gt;Y 2&lt;BR /&gt;_2020 2&lt;BR /&gt;_2021 2&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Mar 2022 02:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804648#M316888</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-29T02:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Import an excel sheet which has the column header on two rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804672#M316904</link>
      <description>&lt;P&gt;Your attached Excel file is missing..&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 06:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804672#M316904</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-29T06:09:46Z</dc:date>
    </item>
    <item>
      <title>To import an Excel file into SAS with column headers on more than one line.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804730#M316943</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please accept my Sincere Apologies for posting the same question again.&lt;/P&gt;&lt;P&gt;I missed the attachment in my previous post and I'm not sure how to add an attachment to the existing post (&lt;A href="https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804672/emcs_t/S2h8ZW1haWx8dG9waWNfc3Vic2NyaXB0aW9ufEwxQlFPV0dXOEkyQURCfDgwNDY3MnxTVUJTQ1JJUFRJT05TfGhL#M316904)" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804672/emcs_t/S2h8ZW1haWx8dG9waWNfc3Vic2NyaXB0aW9ufEwxQlFPV0dXOEkyQURCfDgwNDY3MnxTVUJTQ1JJUFRJT05TfGhL#M316904)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to read an excel file into SAS which has headers on two rows, I tried using the solutions provided here but I was not able to get the desired output.&lt;/P&gt;&lt;P&gt;I thought of reading the .xlsx file twice and assigning the variable names to the merged columns in excel but later realized that the excel sheet/dataset keeps growing for the upcoming months or years.&lt;/P&gt;&lt;P&gt;I also tried to transpose after importing the .xlsx file with GETNAME = NO OPTION.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The transpose results.&lt;BR /&gt;Variable Name Variable Type&lt;BR /&gt;C 2&lt;BR /&gt;E 2&lt;BR /&gt;F 2&lt;BR /&gt;G 2&lt;BR /&gt;GRAND TOTAL 1&lt;BR /&gt;H 2&lt;BR /&gt;I 2&lt;BR /&gt;J 2&lt;BR /&gt;K 2&lt;BR /&gt;L 2&lt;BR /&gt;M 2&lt;BR /&gt;N 2&lt;BR /&gt;O 2&lt;BR /&gt;PROGRAM_TYPE 2&lt;BR /&gt;PRODUCT_TYPE 2&lt;BR /&gt;R 2&lt;BR /&gt;S 2&lt;BR /&gt;T 2&lt;BR /&gt;U 2&lt;BR /&gt;V 2&lt;BR /&gt;W 2&lt;BR /&gt;X 2&lt;BR /&gt;Y 2&lt;BR /&gt;_2020 2&lt;BR /&gt;_2021 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the excel attached, Kindly Suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 12:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804730#M316943</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-29T12:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Import an excel sheet which has the column header on two rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804731#M316941</link>
      <description>Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Thank you for your quick response!&lt;BR /&gt;&lt;BR /&gt;I was not able to upload the file to the existing post.&lt;BR /&gt;Kindly find the attachment in the below post.&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/To-import-an-Excel-file-into-SAS-with-column-headers-on-more/m-p/804730#U804730" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/To-import-an-Excel-file-into-SAS-with-column-headers-on-more/m-p/804730#U804730&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you for your time and guidance!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Mar 2022 12:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804731#M316941</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-29T12:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: To import an Excel file into SAS with column headers on more than one line.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804802#M316971</link>
      <description>&lt;P&gt;Here is how this Forum displays that XLS file.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-29 114625.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69929iAF070C744CF6AAA2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-29 114625.jpg" alt="Screenshot 2022-03-29 114625.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So how many variables do you see there?&lt;/P&gt;
&lt;P&gt;What are the names you would want for them?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 15:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804802#M316971</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-29T15:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: To import an Excel file into SAS with column headers on more than one line.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804807#M316974</link>
      <description>&lt;P&gt;Just tell it to skip the first row.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import dbms=xls datafile="&amp;amp;path/&amp;amp;fname"
  out=example replace
;
 range='$A2:';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-29 115359.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69930i1A8D3D4F53EEA865/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-29 115359.jpg" alt="Screenshot 2022-03-29 115359.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You could clean up the first 3 columns easily using RETAIN.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data step1;
  length program_type product_type $20;
  retain program_type product_type;
  set example;
  if A ne ' ' then do;
     program_type=A;
     product_type=' ';
  end;
  if B ne ' ' then product_type=B;
  rename c=Line_item q=TOTAL;
  drop A B;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2022-03-29 120504.jpg" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/69931i758F4BD40D7DEEB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-03-29 120504.jpg" alt="Screenshot 2022-03-29 120504.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 16:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/804807#M316974</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-29T16:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: To import an Excel file into SAS with column headers on more than one line.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/805243#M317186</link>
      <description>Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Thank you for your Post!!&lt;BR /&gt;Using the below mentioned code I was able to read the Excel files with headers on Multiple rows, and I was working on renaming the columns as the excel sheet keeps growing and also calculating the sales percentages for all the years.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Thu, 31 Mar 2022 12:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-an-excel-sheet-which-has-the-column-header-on-two-rows/m-p/805243#M317186</guid>
      <dc:creator>Santt0sh</dc:creator>
      <dc:date>2022-03-31T12:00:06Z</dc:date>
    </item>
  </channel>
</rss>

