<?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 in column names from txt on multiple rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625710#M184456</link>
    <description>When your data isn't a nice clean formatted file you cannot use PROC IMPORT. You'll need to tell SAS how to read the data using a data step by specifying the layout.&lt;BR /&gt;&lt;BR /&gt;The documentation goes through a couple of examples in detail if you're aiming to understand what's going on:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=basess&amp;amp;docsetTarget=p0s16wvzu0z9q7n0zmxia30s6qyc.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=basess&amp;amp;docsetTarget=p0s16wvzu0z9q7n0zmxia30s6qyc.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 18 Feb 2020 21:25:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-02-18T21:25:31Z</dc:date>
    <item>
      <title>Reading in column names from txt on multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625708#M184454</link>
      <description>&lt;P&gt;I'm a new SAS programmer and am trying to figure out how to read in column headers for a data frame from a text file. The problem is the data look like this:&lt;/P&gt;&lt;P&gt;Var1 Var2 Var3&lt;/P&gt;&lt;P&gt;Var4 Var5 Var6&lt;/P&gt;&lt;P&gt;1 data for 1&lt;/P&gt;&lt;P&gt;data for 1&lt;/P&gt;&lt;P&gt;2 data for 2&lt;/P&gt;&lt;P&gt;data for 2&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;And My output looks like this:&lt;/P&gt;&lt;P&gt;obs Var1 Var2 Var3&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; Var4 Var5 Var6&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 1 data for 1&amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;This is what I have so far any feedback I appreciate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE= "/folders/myfolders/file.txt" out = WORK.MYOUTPUT DBMS= TAB replace;&lt;BR /&gt;getnames = yes;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 21:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625708#M184454</guid>
      <dc:creator>Jcox22</dc:creator>
      <dc:date>2020-02-18T21:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in column names from txt on multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625709#M184455</link>
      <description>&lt;P&gt;Is your file organized so that every observation takes two lines?&amp;nbsp; Or is just the "header" split into two lines?&lt;/P&gt;
&lt;P&gt;Is the split at the same place for every observation (and for the headers?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably will want to skip asking SAS to guess how to read the file and just tell it explicitly how to read it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile  "/folders/myfolders/file.txt" dsd truncover firstobs=3;
  input var1 var2 var3 / var4 var5 var6;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more detailed answer show some actual example (or a representative example) of the lines in the file.&amp;nbsp; Don't paste the lines into the test of your message. Instead use the Insert Code button so you get a pop-up window where you can past text so it will be displayed using fixed width font and it will not be flowed into paragraphs.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2020 21:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625709#M184455</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-18T21:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Reading in column names from txt on multiple rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625710#M184456</link>
      <description>When your data isn't a nice clean formatted file you cannot use PROC IMPORT. You'll need to tell SAS how to read the data using a data step by specifying the layout.&lt;BR /&gt;&lt;BR /&gt;The documentation goes through a couple of examples in detail if you're aiming to understand what's going on:&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=basess&amp;amp;docsetTarget=p0s16wvzu0z9q7n0zmxia30s6qyc.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=basess&amp;amp;docsetTarget=p0s16wvzu0z9q7n0zmxia30s6qyc.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Feb 2020 21:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-in-column-names-from-txt-on-multiple-rows/m-p/625710#M184456</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-18T21:25:31Z</dc:date>
    </item>
  </channel>
</rss>

