<?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 finding text with quotes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958817#M374199</link>
    <description>&lt;P&gt;Hi I have a data set with text from a log file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable called TEXT:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TEXT&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;put 'ERROR' blah blah blah&lt;/P&gt;
&lt;P&gt;put "ERROR:" blah blah blah&lt;/P&gt;
&lt;P&gt;var='ERROR' blah blah blah&lt;/P&gt;
&lt;P&gt;var="ERROR" blah blah blah&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to indentify cases where there is put followed by ERROR (in quotes) and cases where there is an = sign followed by ERROR (in quotes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking of using index but thought PRXMATCH might be better due to the quote marks.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 16:18:01 GMT</pubDate>
    <dc:creator>kalbo</dc:creator>
    <dc:date>2025-02-10T16:18:01Z</dc:date>
    <item>
      <title>finding text with quotes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958817#M374199</link>
      <description>&lt;P&gt;Hi I have a data set with text from a log file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable called TEXT:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TEXT&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;put 'ERROR' blah blah blah&lt;/P&gt;
&lt;P&gt;put "ERROR:" blah blah blah&lt;/P&gt;
&lt;P&gt;var='ERROR' blah blah blah&lt;/P&gt;
&lt;P&gt;var="ERROR" blah blah blah&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to indentify cases where there is put followed by ERROR (in quotes) and cases where there is an = sign followed by ERROR (in quotes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking of using index but thought PRXMATCH might be better due to the quote marks.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 16:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958817#M374199</guid>
      <dc:creator>kalbo</dc:creator>
      <dc:date>2025-02-10T16:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: finding text with quotes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958818#M374200</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    if find(text,"put 'ERROR'")&amp;gt;0 or find(text,'put "ERROR"')&amp;gt;0
        or find(text,'="ERROR"')&amp;gt;0 or find(text,"='ERROR'")&amp;gt;0 then ... &lt;BR /&gt;    ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't finish the "then ..." part of the code, whatever goes there is up to you.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 16:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958818#M374200</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-10T16:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: finding text with quotes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958821#M374202</link>
      <description>&lt;P&gt;You could try this with PRXMATCH (slight edit to deal with the optional colon):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards dsd truncover firstobs=1 dlm=',';
length logstuff $100;
input logstuff;
cards;
put 'ERROR' blah blah blah
put "ERROR-" blah blah blah
put "ERROR:" blah blah blah
var='ERROR' blah blah blah
var="error" blah blah blah
something else
put ERROR
var=error
putERROR
;
run;

proc print data=test; run;

data want;
set test;
ismatch=0;
if prxmatch("m/^(put\s+|var=)\'error:?\'\s*/i",tranwrd(logstuff,'"',"'")) then ismatch=1;
run;

proc print data=want; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="quickbluefish_0-1739206720291.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104510iECDF5DC0C519A431/image-size/medium?v=v2&amp;amp;px=400" role="button" title="quickbluefish_0-1739206720291.png" alt="quickbluefish_0-1739206720291.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 17:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-text-with-quotes/m-p/958821#M374202</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-02-10T17:00:00Z</dc:date>
    </item>
  </channel>
</rss>

