<?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 raw data from a text file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463092#M284954</link>
    <description>&lt;P&gt;Sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step, use the FIND function to see if the line has&amp;nbsp;&lt;SPAN&gt;ESTIMATED PROPORTION CONSISTENTLY CLASSIFIED&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then use the SCAN function to retrieve the last "word" which in this case is .875, convert character to numeric, then output to the data set.&lt;/P&gt;</description>
    <pubDate>Thu, 17 May 2018 18:31:15 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-05-17T18:31:15Z</dc:date>
    <item>
      <title>Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463087#M284953</link>
      <description>&lt;P&gt;Hi - I'm trying to read in a raw text file (.f03), that isn't delimited consistently throughout. I'm able to read it in using a proc import dbms=csv option, and it puts everything into one column. I essentially want to be able to pull 2 different statistics out of this entire file. Is there a way to scan the one variable to keep the stat that comes after&amp;nbsp;"ESTIMATED PROPORTION CONSISTENTLY CLASSIFIED ="? This only appears once in the file.&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="image.png" style="width: 450px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20600iDC824639A547FF33/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 18:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463087#M284953</guid>
      <dc:creator>NR13</dc:creator>
      <dc:date>2018-05-17T18:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463092#M284954</link>
      <description>&lt;P&gt;Sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a data step, use the FIND function to see if the line has&amp;nbsp;&lt;SPAN&gt;ESTIMATED PROPORTION CONSISTENTLY CLASSIFIED&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, then use the SCAN function to retrieve the last "word" which in this case is .875, convert character to numeric, then output to the data set.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 18:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463092#M284954</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-05-17T18:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463098#M284955</link>
      <description>&lt;P&gt;Thank you! Is there anyway you can give me a syntax example of what you're thinking? I'm having trouble getting the scan function to work without explicitly stating what that statistic is.&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 18:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463098#M284955</guid>
      <dc:creator>NR13</dc:creator>
      <dc:date>2018-05-17T18:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463099#M284956</link>
      <description>&lt;P&gt;You can also use a column "pointer" based on the value of text. If the key text is not found then nothing would be read. Keep only the records with values. A raw example;&lt;/P&gt;
&lt;PRE&gt;data junk;
   infile datalines missover;
   input @"Some text" x;
datalines;
Some text 123
No key text 456
893 Some text 333
;
run;&lt;/PRE&gt;
&lt;P&gt;And to keep only records with the value:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
   infile datalines missover;
   input @"Some text" x;
   if x ne .;
datalines;
Some text 123
No key text 456
893 Some text 333
;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 May 2018 18:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463099#M284956</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-17T18:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463102#M284957</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116197"&gt;@NR13&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thank you! Is there anyway you can give me a syntax example of what you're thinking? I'm having trouble getting the scan function to work without explicitly stating what that statistic is.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the line of text has been found to have the desired text string of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ESTIMATED PROPORTION CONSISTENTLY CLASSIFIED, then you can use the SCAN function like this (assuming we are not very creative and the text string is a variable named TEXTSTRING)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number = scan(textstring,-1);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 May 2018 18:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463102#M284957</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-05-17T18:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463103#M284958</link>
      <description>&lt;P&gt;I'm sorry - I know i'm probably doing something stupid. This is what I'm trying:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Try;&lt;BR /&gt;Set Testing;&lt;BR /&gt;Correct=Scan(find(Var1,"ESTIMATED PROPORTION CONSISTENTLY CLASSIFIED"),-1);&lt;BR /&gt;Run;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 19:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463103#M284958</guid>
      <dc:creator>NR13</dc:creator>
      <dc:date>2018-05-17T19:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463106#M284959</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data try;
    set testing;
    if find(var1,'estimated proportion consistently classified','i')&amp;gt;0 then do;
        value=scan(var1,-1)+0;
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 May 2018 19:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463106#M284959</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-05-17T19:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463108#M284960</link>
      <description>&lt;P&gt;You're the best - thank you!!&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 19:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/463108#M284960</guid>
      <dc:creator>NR13</dc:creator>
      <dc:date>2018-05-17T19:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading raw data from a text file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/494416#M284961</link>
      <description>&lt;P&gt;I have below data in an input file. I want to scan using a key word in each line and then want the ouput as below&lt;/P&gt;&lt;P&gt;Input File:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code 201 Created&lt;BR /&gt;Date: Mon, 10 Sep 2018 08:30:56 GMT&lt;BR /&gt;Location: Asia, Singapore&lt;BR /&gt;Length: 150&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Col1&lt;/TD&gt;&lt;TD&gt;Col2&lt;/TD&gt;&lt;TD&gt;Col3&lt;/TD&gt;&lt;TD&gt;Col4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;201&lt;/TD&gt;&lt;TD&gt;Mon, 10 Sep 2018 08:30:56 GMT&lt;/TD&gt;&lt;TD&gt;Asia, Singapore&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Col1: After Code, get the 3 digits&lt;/P&gt;&lt;P&gt;Col2: After "Date: " and till end&lt;/P&gt;&lt;P&gt;Col3: After "Location: " and till end&lt;/P&gt;&lt;P&gt;Col4: After "Length: " and till end&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 08:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-raw-data-from-a-text-file/m-p/494416#M284961</guid>
      <dc:creator>LOVE_SAA</dc:creator>
      <dc:date>2018-09-11T08:23:21Z</dc:date>
    </item>
  </channel>
</rss>

