<?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 txt file with no delimiter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564738#M158436</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To read fixed-column input like this, you can take advantage of using the&amp;nbsp;@column - notation in the Input statement. This gives you full control over the cursor position:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test(drop=i);
	infile "c:\temp\data.txt";
	array score s1-s108;
	do i = 1 to 108;
		input @i score{i} 1. @;
	end;
	input @109 id1 8. @119 id2 $3.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, there are 2 spaces between ID1 and ID2 in your data. The code above reflects that.&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jun 2019 08:37:25 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2019-06-09T08:37:25Z</dc:date>
    <item>
      <title>reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564734#M158434</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a data set as in the picture (I'm not copying the data because I want you to see that I have missing values).The data has 108 items' scores (one digit) and then id1 (8 digits) (no space between items and id) and then one space and id2 (3 digits). The spaces you see are missing values not tab or any type of delimiter for items and id1. When I use infile statement all items are in one column. Could you help me to read this data?The txt file in the attachment has the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&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="data.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30141i4BFAEE985AEF8784/image-size/large?v=v2&amp;amp;px=999" role="button" title="data.jpg" alt="data.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 05:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564734#M158434</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-06-09T05:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564735#M158435</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please put headers in your text file. Its difficult to understand like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushree&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 07:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564735#M158435</guid>
      <dc:creator>anushreebiotech</dc:creator>
      <dc:date>2019-06-09T07:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564738#M158436</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/22174"&gt;@dustychair&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To read fixed-column input like this, you can take advantage of using the&amp;nbsp;@column - notation in the Input statement. This gives you full control over the cursor position:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test(drop=i);
	infile "c:\temp\data.txt";
	array score s1-s108;
	do i = 1 to 108;
		input @i score{i} 1. @;
	end;
	input @109 id1 8. @119 id2 $3.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, there are 2 spaces between ID1 and ID2 in your data. The code above reflects that.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 08:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564738#M158436</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-06-09T08:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564767#M158449</link>
      <description>&lt;P&gt;A good solution,&amp;nbsp; Also note that you can read sequentially without worrying about the starting position:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test(drop=i);
	infile "c:\temp\data.txt";
	array score s1-s108;
	do i = 1 to 108;
		input score{i} 1. @;
	end;
	input id1 8. @119 id2 $3.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 17:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564767#M158449</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-09T17:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564769#M158451</link>
      <description>Thank you SO much!</description>
      <pubDate>Sun, 09 Jun 2019 18:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564769#M158451</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-06-09T18:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: reading txt file with no delimiter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564771#M158452</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The data has 108 items' scores (one digit) and then id1 (8 digits) (no space between items and id) and then one space and id2 (3 digits).&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Just translate your description into an INPUT statement. Use formatted input instead of list mode.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input (score1-score108) (1.) id1 $8. +1 id2 $3. ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 19:09:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-txt-file-with-no-delimiter/m-p/564771#M158452</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-09T19:09:15Z</dc:date>
    </item>
  </channel>
</rss>

