<?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 - varnames and data in unusual rows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773834#M81099</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272647"&gt;@jdsdog10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;xlsx&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Save it to csv and read it with a data step.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Oct 2021 06:21:17 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-10-13T06:21:17Z</dc:date>
    <item>
      <title>Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773749#M81093</link>
      <description>&lt;P&gt;I have my variable names in line 8, and my data starts at line 14. I'm not able to figure out how to import the data while skipping those other lines. Currently I am importing line 8 exclusively, using getnames, creating an empty table with variable names (over 120). Then importing all the data to a temporary table. Then adding the data from the temporary table to the empty table that has the variable names. It seems like there should be a way to designate the header row and designate a different starting row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Update: the variable names are important. I have about 20 different excel files, all with the same format, and each file has different variable names (all 120+) that are important for the task at hand. Editing the file isn't an option at the moment.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 21:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773749#M81093</guid>
      <dc:creator>jdsdog10</dc:creator>
      <dc:date>2021-10-12T21:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773751#M81094</link>
      <description>&lt;P&gt;What kind of file are you reading?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 20:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773751#M81094</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-12T20:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773753#M81095</link>
      <description>&lt;P&gt;Either edit the file so that the variable names are on row 1 and data starts on row 2&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;Write a data step to read data. The Infile statement will allow you to tell which row the data starts on by using the Firstobs= option and you pick/set your variable names with Input/informat/attribute statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Import is designed for reading simple data designed for interchange. Multiple row headings and blank rows are not what it is designed to read.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 20:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773753#M81095</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-12T20:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773754#M81096</link>
      <description>&lt;P&gt;Why go through all that? Write your own data step with FIRSTOBS=14 and be done with it. As a benefit, you also get consistent results.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 20:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773754#M81096</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-12T20:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773763#M81097</link>
      <description>xlsx</description>
      <pubDate>Tue, 12 Oct 2021 21:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773763#M81097</guid>
      <dc:creator>jdsdog10</dc:creator>
      <dc:date>2021-10-12T21:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773791#M81098</link>
      <description>&lt;P&gt;How is it you are reading only the name row?&lt;/P&gt;
&lt;P&gt;Any way here is way that involves reading the file twice. Once starting with the name row and one starting with the data row. Then using PROC DATASETS to rename the variables in the second one with the first row from the first one.&lt;/P&gt;
&lt;P&gt;So let's assume you have the name of the XLSX file in the macro variable FNAME.&lt;/P&gt;
&lt;P&gt;And also that you are reading from a sheet named TEST.&lt;/P&gt;
&lt;P&gt;So this code will create a dataset named VALUES with the data from row 14 using the names from row 8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile="&amp;amp;fname" dbms=xlsx out=names replace ;
   getnames=no;
   range="test$A8:";
run;
proc import datafile="&amp;amp;fname" dbms=xlsx out=values replace ;
   getnames=no;
   range="test$A14:";
run;

proc transpose data=names(obs=1) out=name_list;
  var _all_;
run;
proc sql noprint;
  select catx('=',_name_,nliteral(col1))
    into :renames separated by ' '
    from name_list
    where upcase(_name_) ne upcase(col1)
  ;
quit;

proc datasets nolist lib=work;
  modify values ;
    rename &amp;amp;renames;
  run;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 23:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773791#M81098</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-12T23:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import - varnames and data in unusual rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773834#M81099</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272647"&gt;@jdsdog10&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;xlsx&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Save it to csv and read it with a data step.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 06:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-import-varnames-and-data-in-unusual-rows/m-p/773834#M81099</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-13T06:21:17Z</dc:date>
    </item>
  </channel>
</rss>

