<?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: How do I import txt file that is both delimited and has next lines i need for a column in Programming 1 and 2</title>
    <link>https://communities.sas.com/t5/Programming-1-and-2/How-do-I-import-txt-file-that-is-both-delimited-and-has-next/m-p/863617#M1295</link>
    <description>&lt;P&gt;"Import" is the wrong verb for the action you need to do.&amp;nbsp; You just need to READ the text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's take your sample lines and convert it to a file so we have something to code against.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options parmcards=text ;
filename text temp;
parmcards;
mark
m_21
ash
m_18
bumi
f_36
bambam
f_36
bacon
f_23
bona
f_23
bingo
m_36
lena
f_18
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's write a data step that will read NAME from one line and GENDER and AGE from the next.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile text dlm='_' truncover ;
  input name $30.  / gender :$1. age ;
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="Tom_0-1678570189823.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81379i88C4348365CECF23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1678570189823.png" alt="Tom_0-1678570189823.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Mar 2023 21:29:57 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-03-11T21:29:57Z</dc:date>
    <item>
      <title>How do I import txt file that is both delimited and has next lines i need for a column</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/How-do-I-import-txt-file-that-is-both-delimited-and-has-next/m-p/863614#M1294</link>
      <description>&lt;P&gt;Hello, I think I posted same question before but not sure where my topic went. I'm a new sas user using sas studio, I hope you can help me with my journey.&lt;/P&gt;&lt;P&gt;Q:I was looking to create a sas data set with 3 columns: &lt;STRONG&gt;name,gender,age&lt;/STRONG&gt; from this text file that looks like the one below. I'm having trouble because it's not just delimited but some of the columns i need is all in one column in the txt file. whenever i do the proc import step i get a data set with column name with everything under it.&lt;/P&gt;&lt;P&gt;mark&lt;BR /&gt;m_21&lt;BR /&gt;ash&lt;BR /&gt;m_18&lt;BR /&gt;bumi&lt;BR /&gt;f_36&lt;BR /&gt;bambam&lt;BR /&gt;f_36&lt;BR /&gt;bacon&lt;BR /&gt;f_23&lt;BR /&gt;bona&lt;BR /&gt;f_23&lt;BR /&gt;bingo&lt;BR /&gt;m_36&lt;BR /&gt;lena&lt;BR /&gt;f_18&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 20:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/How-do-I-import-txt-file-that-is-both-delimited-and-has-next/m-p/863614#M1294</guid>
      <dc:creator>Machan69</dc:creator>
      <dc:date>2023-03-11T20:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I import txt file that is both delimited and has next lines i need for a column</title>
      <link>https://communities.sas.com/t5/Programming-1-and-2/How-do-I-import-txt-file-that-is-both-delimited-and-has-next/m-p/863617#M1295</link>
      <description>&lt;P&gt;"Import" is the wrong verb for the action you need to do.&amp;nbsp; You just need to READ the text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's take your sample lines and convert it to a file so we have something to code against.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options parmcards=text ;
filename text temp;
parmcards;
mark
m_21
ash
m_18
bumi
f_36
bambam
f_36
bacon
f_23
bona
f_23
bingo
m_36
lena
f_18
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's write a data step that will read NAME from one line and GENDER and AGE from the next.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile text dlm='_' truncover ;
  input name $30.  / gender :$1. age ;
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="Tom_0-1678570189823.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81379i88C4348365CECF23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1678570189823.png" alt="Tom_0-1678570189823.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 21:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Programming-1-and-2/How-do-I-import-txt-file-that-is-both-delimited-and-has-next/m-p/863617#M1295</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-11T21:29:57Z</dc:date>
    </item>
  </channel>
</rss>

