<?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: Choosing values from colums not matching in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529424#M144651</link>
    <description>&lt;P&gt;Use the findw() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',';
input atty :$30. firm :$30.;
cards;
Scott,Scott and Wagner
Hampshire,Mills and Walker
Beasley,Jones and Beasley
;
run;

data want;
set have;
choose = ifc(findw(firm,strip(atty)),' ','Y');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the function that strips the trailing (and/or leading) blanks from atty.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Jan 2019 15:49:22 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-01-23T15:49:22Z</dc:date>
    <item>
      <title>Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529416#M144645</link>
      <description>&lt;P&gt;Lets say I have a dataset that produces two columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ATTY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FIRM&lt;/P&gt;
&lt;P&gt;Scott&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Scott and Wagner&lt;/P&gt;
&lt;P&gt;Hampshire&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mills and Walker&lt;/P&gt;
&lt;P&gt;Beasley&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jones and Beasley&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case I want to&amp;nbsp;have a flag that says if any part of the name &lt;U&gt;&lt;STRONG&gt;DOES NOT MATCH&lt;/STRONG&gt; &lt;/U&gt;(ATTY and FIRM)&amp;nbsp;&amp;nbsp;then put a 'Y' in a flag called Choose, else do not choose it.&amp;nbsp; So in this case only Hampshire&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mills and Walker would get chosen.&amp;nbsp; Is there a way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ATTY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FIRM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; choose&lt;/P&gt;
&lt;P&gt;Scott&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Scott and Wagner&lt;/P&gt;
&lt;P&gt;Hampshire&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mills and Walker&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y&lt;/P&gt;
&lt;P&gt;Beasley&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jones and Beasley&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 15:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529416#M144645</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-01-23T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529424#M144651</link>
      <description>&lt;P&gt;Use the findw() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards dlm=',';
input atty :$30. firm :$30.;
cards;
Scott,Scott and Wagner
Hampshire,Mills and Walker
Beasley,Jones and Beasley
;
run;

data want;
set have;
choose = ifc(findw(firm,strip(atty)),' ','Y');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the function that strips the trailing (and/or leading) blanks from atty.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jan 2019 15:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529424#M144651</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-23T15:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529427#M144654</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
infile cards dlm=',';
input atty :$30. firm :$30.;
cards;
Scott,Scott and Wagner
Hampshire,Mills and Walker
Beasley,Jones and Beasley
;
run;


data want;
set have;
if not indexw(firm,strip(atty)) then choose='Y';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jan 2019 15:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529427#M144654</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-23T15:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529867#M144842</link>
      <description>Thanks for your input here.  I was wondering why it did not work exactly as planned&lt;BR /&gt;data have;&lt;BR /&gt;infile cards dlm=',';&lt;BR /&gt;input atty :$30. firm :$30.;&lt;BR /&gt;cards;&lt;BR /&gt;Scott,Scott and Wagner&lt;BR /&gt;Hampshire,Mills and Walker&lt;BR /&gt;Beasley,Jones and Beasley&lt;BR /&gt;Beasley,Jones and Bonds&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;choose = ifc(findw(firm,strip(atty)),' ','Y');&lt;BR /&gt;run;&lt;BR /&gt;For the last one Beasley,Jones and Bonds  I would get a 'Y' because it see the 'B' which is a character  match.  Is there a way to force it to look at the first 2 or 3 characters.  In this example I would want this last entry NOT to be a match</description>
      <pubDate>Thu, 24 Jan 2019 21:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529867#M144842</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-01-24T21:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529868#M144843</link>
      <description>&lt;P&gt;Lets say the last entry&amp;nbsp; Beasley,Jones and Beasley&amp;nbsp; was Beasley,Jones and Bond instead.&lt;/P&gt;
&lt;P&gt;I would still get a 'Y' for a match.&lt;/P&gt;
&lt;P&gt;Is there a way to get this to look at the first 2 or 3 characters.&amp;nbsp; In that case the last entry would not be a match which is what I would want in this case. The code you provided is effective however if the first char is a match in either column we get a 'Y' which is not what I would want&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:16:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529868#M144843</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-01-24T21:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529874#M144846</link>
      <description>&lt;P&gt;Can you modify the sample input and the output for the sample plz&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529874#M144846</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-24T21:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529877#M144849</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dlm&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=',';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; atty :&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$30.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; firm :&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$30.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;cards&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scott,Scott and Wagner&lt;/P&gt;
&lt;P&gt;Hampshire,Mills and Walker&lt;/P&gt;
&lt;P&gt;Beasley,Jones and Bond&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;　&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;not&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; indexw(firm,strip(atty)) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; choose='Y';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So in this case because in the last entry the "B" in Beasley happens to match the "B" in Bonds, we would get a 'Y'.&amp;nbsp; However is there a way to get the code to look at the first 2 or 3 char and apply the same logic.&amp;nbsp; In this case since Beasley is not Bond I would want this to not show a 'Y' for a match, currently it does&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529877#M144849</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2019-01-24T21:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Choosing values from colums not matching</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529888#M144854</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp; &amp;nbsp;The Y is case of non matches both my code and Kurt's.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result that you see below in the 2nd and 3rd record being 'Y' is a result of&amp;nbsp; the condition &lt;EM&gt;&lt;STRONG&gt;"&lt;U&gt;not&lt;/U&gt; indexw" (note the not&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;or in other words&lt;STRONG&gt; false positives.&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;So basically, &lt;STRONG&gt;Y is a result of non-matches&lt;/STRONG&gt; and not matches.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This meets your original question where you wrote =&lt;EM&gt;"&lt;SPAN&gt;In this case I want to&amp;nbsp;have a flag that says if any part of the name&lt;/SPAN&gt;&lt;U&gt;&lt;STRONG&gt;DOES NOT MATCH&lt;/STRONG&gt;&lt;/U&gt;&lt;SPAN&gt;(ATTY and FIRM)&amp;nbsp;&amp;nbsp;then put a 'Y' in a flag called Choose, else do not choose it"&lt;/SPAN&gt;&lt;/EM&gt; Kindly review&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l header" scope="col"&gt;atty&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;firm&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;choose&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Scott&lt;/TD&gt;
&lt;TD class="l data"&gt;Scott and Wagner&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Hampshire&lt;/TD&gt;
&lt;TD class="l data"&gt;Mills and Walker&lt;/TD&gt;
&lt;TD class="l data"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Beasley&lt;/TD&gt;
&lt;TD class="l data"&gt;Jones and Bond&lt;/TD&gt;
&lt;TD class="l data"&gt;Y&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&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/5629"&gt;@Q1983&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So in this case because in the last entry the "B" in Beasley happens to match the "B" in Bonds, we would get a 'Y'.&amp;nbsp; However is there a way to get the code to look at the first 2 or 3 char and apply the same logic.&amp;nbsp; In this case since Beasley is not Bond I would want this to not show a 'Y' for a match, currently it does&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Choosing-values-from-colums-not-matching/m-p/529888#M144854</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-24T21:45:05Z</dc:date>
    </item>
  </channel>
</rss>

