<?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: Scanning and getting combinations from a long field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280755#M56787</link>
    <description>thank you Kurt!</description>
    <pubDate>Tue, 28 Jun 2016 12:54:45 GMT</pubDate>
    <dc:creator>angeliquec</dc:creator>
    <dc:date>2016-06-28T12:54:45Z</dc:date>
    <item>
      <title>Scanning and getting combinations from a long field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280740#M56782</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this dataset (have) with number combinations in column b.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If column b contains the numbers 100, 200, 100 and 200, it should give the tag ="check".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If column b contains a combination of 100 and not 200, it should give no tag.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can this be possible in one data step?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code is below:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input a b :$32.;&lt;BR /&gt;cards;&lt;BR /&gt;1 100-100&lt;BR /&gt;2 300&lt;BR /&gt;3 200-100&lt;BR /&gt;4 300-300-300-100&lt;BR /&gt;5 200&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*If b in ('100', '200') then tag = "check"*/&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;input a b :$32. tag $5.;&lt;BR /&gt;cards;&lt;BR /&gt;1 100-100 tag&lt;BR /&gt;2 300 &lt;BR /&gt;3 200-100 tag&lt;BR /&gt;4 300-300-100&lt;BR /&gt;5 200 tag&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 12:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280740#M56782</guid>
      <dc:creator>angeliquec</dc:creator>
      <dc:date>2016-06-28T12:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scanning and getting combinations from a long field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280747#M56784</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a b :$32.;
cards;
1 100-100
2 300
3 200-100
4 300-300-300-100
5 200
;
run;

data want;
set have;
marker_100 = 0;
marker_else = 0;
do i = 1 to countw(b,'-');
  if scan(b,i,'-') in ('100','200')
  then marker_100 = 1;
  else marker_else = 1;
end;
if marker_100 and not marker_else then tag = 'tag';
drop i marker_100 marker_else;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jun 2016 12:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280747#M56784</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-28T12:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scanning and getting combinations from a long field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280755#M56787</link>
      <description>thank you Kurt!</description>
      <pubDate>Tue, 28 Jun 2016 12:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scanning-and-getting-combinations-from-a-long-field/m-p/280755#M56787</guid>
      <dc:creator>angeliquec</dc:creator>
      <dc:date>2016-06-28T12:54:45Z</dc:date>
    </item>
  </channel>
</rss>

