<?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: Using prxmatch to make dummy variables from alphanumeric variable and not getting correct output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882575#M348676</link>
    <description>&lt;P&gt;You discuss and use as example searching for E45 and do not include any values containing E45. So what exactly are you searching for? Please do not make us have to guess exactly what you are searching for.&lt;/P&gt;
&lt;P&gt;You should include at least one example of each type of search &lt;STRONG&gt;and&lt;/STRONG&gt; show the result.&lt;/P&gt;
&lt;P&gt;Any time you have a question about an error or warning message then best practice is to copy from the &lt;STRONG&gt;log&lt;/STRONG&gt; the entire procedure or data step code generating the message an all the notes, warnings, messages or errors then on the forum open a text box using the &amp;lt;/&amp;gt; icon above the message window and paste all of that text. The text box will preserve formatting of many of the diagnostic messages SAS provides.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your particular warning is about 90% of the time caused by either a missing quote or mismatched quote (one single quote and one double) somewhere. Which is why you should provide the entire code as the message may not appear until several lines after the problem starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that you are searching in the middle, so 'any string starts with' is apparently a misdirection unless you define what starts a 'string'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282041"&gt;@GreenTriangle&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm trying to search for multiple alphanumeric strings in a variable. There are two types of searches I want to do: 1. Search for only the specific string (e.g. E45 only, not any string that contains E45) and 2. search for any string that starts with a specified string of characters (e.g. any string that begins with E45). Once I identify any of these alphanumeric strings I want to flag it as 1 and if the strings are not present, I want the variable to be 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't just copy and paste the data here for privacy reasons but it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;input alphanum $ ;&lt;BR /&gt;datalines;&lt;BR /&gt;G85.0;Z58.6;;&lt;BR /&gt;;;&lt;BR /&gt;Z00.125;F80.14;F82.0;&lt;BR /&gt;;;;E66.09;H54.0;E66.9;E66.01;&lt;BR /&gt;Z68.55&lt;BR /&gt;F20.96&lt;BR /&gt;F32O&lt;BR /&gt;F331;Z68.55;Z67.56;Z74.89;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote code like this for each of the flags:&amp;nbsp; if prxmatch('/^H5G|\bH5X.66\b|\bH5F.1G\b|^H5D\b/', icd10)&amp;gt;0 then test_flag=1;&amp;nbsp;&lt;BR /&gt;else test_flag=0;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is a ^ then it should pull in any strings that begin with those letters and numbers. If the string is bordered by \b, then it should only flag it if that exact string appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the flags worked but some of them are flagging strings they should not be, completely unrelated strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did get this as a warning on some of the flags but am not sure how to fix it:&lt;/P&gt;
&lt;P&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You&lt;BR /&gt;might have unbalanced quotation marks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could this cause it? IS prxmatch just not meant to work with this kind of data and if so, is there another way to search multiple alphanumeric strings?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jun 2023 04:25:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-06-27T04:25:15Z</dc:date>
    <item>
      <title>Using prxmatch to make dummy variables from alphanumeric variable and not getting correct output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882573#M348675</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to search for multiple alphanumeric strings in a variable. There are two types of searches I want to do: 1. Search for only the specific string (e.g. E45 only, not any string that contains E45) and 2. search for any string that starts with a specified string of characters (e.g. any string that begins with E45). Once I identify any of these alphanumeric strings I want to flag it as 1 and if the strings are not present, I want the variable to be 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't just copy and paste the data here for privacy reasons but it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;input alphanum $ ;&lt;BR /&gt;datalines;&lt;BR /&gt;G85.0;Z58.6;;&lt;BR /&gt;;;&lt;BR /&gt;Z00.125;F80.14;F82.0;&lt;BR /&gt;;;;E66.09;H54.0;E66.9;E66.01;&lt;BR /&gt;Z68.55&lt;BR /&gt;F20.96&lt;BR /&gt;F32O&lt;BR /&gt;F331;Z68.55;Z67.56;Z74.89;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote code like this for each of the flags:&amp;nbsp; if prxmatch('/^H5G|\bH5X.66\b|\bH5F.1G\b|^H5D\b/', icd10)&amp;gt;0 then test_flag=1;&amp;nbsp;&lt;BR /&gt;else test_flag=0;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is a ^ then it should pull in any strings that begin with those letters and numbers. If the string is bordered by \b, then it should only flag it if that exact string appears.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of the flags worked but some of them are flagging strings they should not be, completely unrelated strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did get this as a warning on some of the flags but am not sure how to fix it:&lt;/P&gt;&lt;P&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You&lt;BR /&gt;might have unbalanced quotation marks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could this cause it? IS prxmatch just not meant to work with this kind of data and if so, is there another way to search multiple alphanumeric strings?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 04:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882573#M348675</guid>
      <dc:creator>GreenTriangle</dc:creator>
      <dc:date>2023-06-27T04:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using prxmatch to make dummy variables from alphanumeric variable and not getting correct output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882575#M348676</link>
      <description>&lt;P&gt;You discuss and use as example searching for E45 and do not include any values containing E45. So what exactly are you searching for? Please do not make us have to guess exactly what you are searching for.&lt;/P&gt;
&lt;P&gt;You should include at least one example of each type of search &lt;STRONG&gt;and&lt;/STRONG&gt; show the result.&lt;/P&gt;
&lt;P&gt;Any time you have a question about an error or warning message then best practice is to copy from the &lt;STRONG&gt;log&lt;/STRONG&gt; the entire procedure or data step code generating the message an all the notes, warnings, messages or errors then on the forum open a text box using the &amp;lt;/&amp;gt; icon above the message window and paste all of that text. The text box will preserve formatting of many of the diagnostic messages SAS provides.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your particular warning is about 90% of the time caused by either a missing quote or mismatched quote (one single quote and one double) somewhere. Which is why you should provide the entire code as the message may not appear until several lines after the problem starts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It appears that you are searching in the middle, so 'any string starts with' is apparently a misdirection unless you define what starts a 'string'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/282041"&gt;@GreenTriangle&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm trying to search for multiple alphanumeric strings in a variable. There are two types of searches I want to do: 1. Search for only the specific string (e.g. E45 only, not any string that contains E45) and 2. search for any string that starts with a specified string of characters (e.g. any string that begins with E45). Once I identify any of these alphanumeric strings I want to flag it as 1 and if the strings are not present, I want the variable to be 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't just copy and paste the data here for privacy reasons but it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;input alphanum $ ;&lt;BR /&gt;datalines;&lt;BR /&gt;G85.0;Z58.6;;&lt;BR /&gt;;;&lt;BR /&gt;Z00.125;F80.14;F82.0;&lt;BR /&gt;;;;E66.09;H54.0;E66.9;E66.01;&lt;BR /&gt;Z68.55&lt;BR /&gt;F20.96&lt;BR /&gt;F32O&lt;BR /&gt;F331;Z68.55;Z67.56;Z74.89;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote code like this for each of the flags:&amp;nbsp; if prxmatch('/^H5G|\bH5X.66\b|\bH5F.1G\b|^H5D\b/', icd10)&amp;gt;0 then test_flag=1;&amp;nbsp;&lt;BR /&gt;else test_flag=0;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is a ^ then it should pull in any strings that begin with those letters and numbers. If the string is bordered by \b, then it should only flag it if that exact string appears.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the flags worked but some of them are flagging strings they should not be, completely unrelated strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did get this as a warning on some of the flags but am not sure how to fix it:&lt;/P&gt;
&lt;P&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You&lt;BR /&gt;might have unbalanced quotation marks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could this cause it? IS prxmatch just not meant to work with this kind of data and if so, is there another way to search multiple alphanumeric strings?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 04:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882575#M348676</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-27T04:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using prxmatch to make dummy variables from alphanumeric variable and not getting correct output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882586#M348683</link>
      <description>&lt;P&gt;...and... you're not even searching for&amp;nbsp;&lt;SPAN&gt;E45&amp;nbsp;in your regex (!) ...and... your dataset does not work &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;F44.0?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_without_mouth:"&gt;😶&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 09:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882586#M348683</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-06-27T09:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using prxmatch to make dummy variables from alphanumeric variable and not getting correct output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882597#M348689</link>
      <description>&lt;P&gt;Of course, you don't need to use PRXMATCH&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search 1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if string = 'E45' then ...&amp;nbsp;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Search 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if string =: 'E45' then ... ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The two searches you want to search for can be collapsed into the code I provide for search 2, and search 1 is not needed.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 10:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-prxmatch-to-make-dummy-variables-from-alphanumeric/m-p/882597#M348689</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-27T10:15:02Z</dc:date>
    </item>
  </channel>
</rss>

