<?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 to extract only the first column of data from a txt file in SAS EG? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822415#M324759</link>
    <description>&lt;P&gt;We need to see your original data as is, not a description.&lt;/P&gt;
&lt;P&gt;Open your text file with a text editor (e.g. Notepad) and copy/paste the first few lines into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jul 2022 06:27:15 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-09T06:27:15Z</dc:date>
    <item>
      <title>How to extract only the first column of data from a txt file in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822367#M324737</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a txt file and i need to pick only the first value from the txt file in sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how the txt file header looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ACC_ID&amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp;Address&amp;nbsp; phone_no&amp;nbsp; email&amp;nbsp; country&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract just the ACC_ID data from this text file. The file is not delimited and the ACC_ID field is a numerical field (eg: 234908, 789087, 783420 etc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 21:31:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822367#M324737</guid>
      <dc:creator>Rhino84</dc:creator>
      <dc:date>2022-07-08T21:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the first column of data from a txt file in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822415#M324759</link>
      <description>&lt;P&gt;We need to see your original data as is, not a description.&lt;/P&gt;
&lt;P&gt;Open your text file with a text editor (e.g. Notepad) and copy/paste the first few lines into a window opened with this button:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 06:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822415#M324759</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-09T06:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the first column of data from a txt file in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822427#M324766</link>
      <description>Can you post some real data, so we can test the code .</description>
      <pubDate>Sat, 09 Jul 2022 10:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822427#M324766</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-09T10:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract only the first column of data from a txt file in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822438#M324773</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391324"&gt;@Rhino84&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a txt file and i need to pick only the first value from the txt file in sas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how the txt file header looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ACC_ID&amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp;Address&amp;nbsp; phone_no&amp;nbsp; email&amp;nbsp; country&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to extract just the ACC_ID data from this text file. The file is not delimited and the ACC_ID field is a numerical field (eg: 234908, 789087, 783420 etc)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As long as each ACC_ID does not contain any spaces and there is at least one space between the ACC_ID and the NAME value then a simple INPUT statement should work fine.&lt;/P&gt;
&lt;P&gt;You claim ACC_ID is numerical but why would you store an ID variable as a number?&amp;nbsp; The Mean or Standard Deviation of an ID has no meaning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'myfile.txt' firstobs=2;
  input acc_id :$10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The FIRSTOBS=2 option on the INFILE statement is to skip the header row.&lt;/P&gt;
&lt;P&gt;The : modifier before the informat is to make sure the INPUT only reads the first word on the line.&lt;/P&gt;
&lt;P&gt;If you really need to make ACC_ID as numeric then just remove the :$10. from the INPUT statement.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 16:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-only-the-first-column-of-data-from-a-txt-file-in/m-p/822438#M324773</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-09T16:11:23Z</dc:date>
    </item>
  </channel>
</rss>

