<?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 find a word in a raw data file in Developers</title>
    <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24847#M2524</link>
    <description>Hello, guys.&lt;BR /&gt;
i am a beginner in SAS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I have a SAS-log file, and i want to find a word (ex: "STOP") there and the line number of it.&lt;BR /&gt;
i try to make a simple code to find  the word like this:&lt;BR /&gt;
 &lt;BR /&gt;
data temp;&lt;BR /&gt;
	length word $20;&lt;BR /&gt;
	infile  "c:\temp\myFile.LOG" dlm=' ';&lt;BR /&gt;
	input word $ @@;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data findWord;&lt;BR /&gt;
	set temp;&lt;BR /&gt;
	where upcase(word) like 'STOP' ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
any idea to find the line number? or another code?&lt;BR /&gt;
thank you.&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
capricornday</description>
    <pubDate>Wed, 29 Apr 2009 05:26:19 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-29T05:26:19Z</dc:date>
    <item>
      <title>find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24847#M2524</link>
      <description>Hello, guys.&lt;BR /&gt;
i am a beginner in SAS &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I have a SAS-log file, and i want to find a word (ex: "STOP") there and the line number of it.&lt;BR /&gt;
i try to make a simple code to find  the word like this:&lt;BR /&gt;
 &lt;BR /&gt;
data temp;&lt;BR /&gt;
	length word $20;&lt;BR /&gt;
	infile  "c:\temp\myFile.LOG" dlm=' ';&lt;BR /&gt;
	input word $ @@;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data findWord;&lt;BR /&gt;
	set temp;&lt;BR /&gt;
	where upcase(word) like 'STOP' ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
any idea to find the line number? or another code?&lt;BR /&gt;
thank you.&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
capricornday</description>
      <pubDate>Wed, 29 Apr 2009 05:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24847#M2524</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-29T05:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24848#M2525</link>
      <description>data findWord;&lt;BR /&gt;
set temp;&lt;BR /&gt;
where upcase(word) like 'STOP' ;&lt;BR /&gt;
line_number1 = _n_;&lt;BR /&gt;
line_number2 +1;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 29 Apr 2009 07:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24848#M2525</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-04-29T07:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24849#M2526</link>
      <description>thanks to Geniz,&lt;BR /&gt;
&lt;BR /&gt;
but this isn't exactly what i mean.. &lt;BR /&gt;
From log file is a text like this : &lt;BR /&gt;
&lt;BR /&gt;
line ...&lt;BR /&gt;
line 1999&lt;BR /&gt;
line 2000  NOTE: The SAS System &lt;B&gt;stop&lt;/B&gt;ped processing this step because of errors.&lt;BR /&gt;
line 2001  NOTE: SAS set option OBS=0 and will continue to check statements. &lt;BR /&gt;
line 2002      This may cause NOTE: No observations in data set.&lt;BR /&gt;
line 2003  WARNING: The data set WORK.DATA may be incomplete.  &lt;BR /&gt;
line 2004         When this step was &lt;B&gt;stop&lt;/B&gt;ped there were 0 &lt;BR /&gt;
line 2005         observations and 0 variables.&lt;BR /&gt;
line 2006&lt;BR /&gt;
line ....&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
so.. i have 2 lines contain word 'STOP'&lt;BR /&gt;
&lt;BR /&gt;
line                     word&lt;BR /&gt;
-----------              ------------&lt;BR /&gt;
2000                    stop&lt;BR /&gt;
2004                    stop&lt;BR /&gt;
....                        ....&lt;BR /&gt;
&lt;BR /&gt;
thanks&lt;BR /&gt;
regards&lt;BR /&gt;
&lt;BR /&gt;
capricornday</description>
      <pubDate>Wed, 29 Apr 2009 08:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24849#M2526</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-29T08:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24850#M2527</link>
      <description>Hi:&lt;BR /&gt;
  Several folks have written papers about post-processing the SAS log file. This is just one of them. If you look at the programs in this paper, you may get some ideas of how to proceed:&lt;BR /&gt;
&lt;A href="http://analytics.ncsu.edu/sesug/2004/SY05-Foley.pdf" target="_blank"&gt;http://analytics.ncsu.edu/sesug/2004/SY05-Foley.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 29 Apr 2009 14:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24850#M2527</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-04-29T14:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24851#M2528</link>
      <description>Beware that you may not always find a consistent line-numbering "experience" with SAS, unfortunately.  However, with very basic SAS program executions, you should find the SAS "line number" followed by the respective code for that line.&lt;BR /&gt;
&lt;BR /&gt;
My recommendation is to read the log file, a line at a time, parsing it for a line number, followed by some remaining text (to be either a "note", "error", or maybe SAS code.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS 9.2 Language DOC - Reading Raw Data&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001112330.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001112330.htm&lt;/A&gt;</description>
      <pubDate>Wed, 29 Apr 2009 18:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24851#M2528</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-29T18:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24852#M2529</link>
      <description>thanks for the link! and  i will check the "Reading Raw Data" again.. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
regards&lt;BR /&gt;
&lt;BR /&gt;
capricornday</description>
      <pubDate>Fri, 08 May 2009 08:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24852#M2529</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-08T08:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: find a word in a raw data file</title>
      <link>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24853#M2530</link>
      <description>This kind of thing is a straightforward requirement, so it should be easy.&lt;BR /&gt;
Infile option line= helps.[pre]data stops( keep= row line ) ;&lt;BR /&gt;
   do until( end_of_data ) ;&lt;BR /&gt;
      infile 'your log file' line= rowNum scanover  ;&lt;BR /&gt;
      input @'STOP' @ ;&lt;BR /&gt;
      row= rowNum ; * variables named by statement options cannot be kept;&lt;BR /&gt;
      length line $256 ;&lt;BR /&gt;
      line= _infile_ ; &lt;BR /&gt;
      input ; * release current line ;&lt;BR /&gt;
   end ;&lt;BR /&gt;
   stop ;&lt;BR /&gt;
run ;[/pre]What introduces a difficulty is that the line= information seems to be reset at each data step iteration, so you have to avoid that by coding your own iteration (like that demo above).&lt;BR /&gt;
 &lt;BR /&gt;
Good Luck &lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 08 May 2009 13:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/find-a-word-in-a-raw-data-file/m-p/24853#M2530</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-05-08T13:01:25Z</dc:date>
    </item>
  </channel>
</rss>

