<?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 identify the numbers inside '||' and mark them in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961911#M374962</link>
    <description>&lt;P&gt;After testing, I found that SAS does not make errors. Thank you very much for your contribution.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Mar 2025 16:51:13 GMT</pubDate>
    <dc:creator>shawnchen0321</dc:creator>
    <dc:date>2025-03-14T16:51:13Z</dc:date>
    <item>
      <title>How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961906#M374957</link>
      <description>&lt;P&gt;Hello experts:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The original data records the different problems that occurred in the company (recorded in numbers) and are separated by '||', as shown below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data;
input string$40.;
datalines;
|17|42|44|
|17|33|55|2|
|5|12|17|42|44|77|
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to mark the company that has 42 or 12 problems as having a big problem (big_problem) as 1, so the first and third records will be 1, and the second record will be 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to the experts.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 15:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961906#M374957</guid>
      <dc:creator>shawnchen0321</dc:creator>
      <dc:date>2025-03-14T15:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961907#M374958</link>
      <description>&lt;P&gt;You have a character variable with a list of problem identifiers, separated by pipe symbols.&amp;nbsp; Treat those pipes as word separators, in the SCAN function.&amp;nbsp; Use the SCAN function to examine each "word" in the string, to see if any has a value of "42" or "12":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data data;
input string$40.;
datalines;
|17|42|44|
|17|33|55|2|
|5|12|17|42|44|77|
run;
data want;
  set data;
  big_problem=0;
  do w=1 to countw(string,'|') while (big_problem=0);
    if strip(scan(string,w,'|')) in ('12','42') then big_problem=1;
  end;
  drop w;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The STRIP function removes leading and trailing blanks, if there are any, in each constituent of the string variable.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 17:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961907#M374958</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2025-03-14T17:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961909#M374960</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;Thank you for your assistance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question. If the company with a big problem is 2 or 42, how can I avoid 2 by catching 2 instead of catching 12 and 42?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 16:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961909#M374960</guid>
      <dc:creator>shawnchen0321</dc:creator>
      <dc:date>2025-03-14T16:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961910#M374961</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/420121"&gt;@shawnchen0321&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;@Thank you for your assistance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question. If the company with a big problem is 2 or 42, how can I avoid 2 by catching 2 instead of catching 12 and 42?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a perfect opportunity to do a test.&amp;nbsp; Create a string with 12 (and no 2) and a string with 2 (and no 12).&amp;nbsp; Then see whether the code generates a false positive from the string with 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 16:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961910#M374961</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2025-03-14T16:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961911#M374962</link>
      <description>&lt;P&gt;After testing, I found that SAS does not make errors. Thank you very much for your contribution.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 16:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961911#M374962</guid>
      <dc:creator>shawnchen0321</dc:creator>
      <dc:date>2025-03-14T16:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the numbers inside '||' and mark them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961952#M374979</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/420121"&gt;@shawnchen0321&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;After testing, I found that SAS does not make errors. Thank you very much for your contribution.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think that you meant to say that the "code provided by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt; does what is needed". &lt;/P&gt;</description>
      <pubDate>Sat, 15 Mar 2025 17:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-identify-the-numbers-inside-and-mark-them/m-p/961952#M374979</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-03-15T17:16:32Z</dc:date>
    </item>
  </channel>
</rss>

