<?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 do I identify that components of one column does not match the components in another column? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807528#M318395</link>
    <description>&lt;P&gt;It worked! I really appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just so that I have a good understanding of what happened, what does 'it' do when it's in the function of FIND()? I never thought about trying out this way nor seen other responses.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2022 01:56:50 GMT</pubDate>
    <dc:creator>jsyang56</dc:creator>
    <dc:date>2022-04-13T01:56:50Z</dc:date>
    <item>
      <title>How do I identify that components of one column does not match the components in another column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807522#M318391</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to identify whether components in one column match the components in another column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Person ID&lt;/TD&gt;&lt;TD&gt;var1&lt;/TD&gt;&lt;TD&gt;start date&lt;/TD&gt;&lt;TD&gt;Var2&lt;/TD&gt;&lt;TD&gt;v2_start date&lt;/TD&gt;&lt;TD&gt;v2_end date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Dog+Pig&lt;/TD&gt;&lt;TD&gt;01/18/2018&lt;/TD&gt;&lt;TD&gt;dog&lt;/TD&gt;&lt;TD&gt;04/12/2018&lt;/TD&gt;&lt;TD&gt;04/19/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Dog+Pig&lt;/TD&gt;&lt;TD&gt;01/18/2018&lt;/TD&gt;&lt;TD&gt;pig&lt;/TD&gt;&lt;TD&gt;07/25/2018&lt;/TD&gt;&lt;TD&gt;08/22/2018&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Dog+Pig&lt;/TD&gt;&lt;TD&gt;01/18/2018&lt;/TD&gt;&lt;TD&gt;lion&lt;/TD&gt;&lt;TD&gt;10/04/2018&lt;/TD&gt;&lt;TD&gt;11/15/2018&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the table, I want to set some conditions to identify the dates and var2. The conditions are&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) "var2" does NOT contain any words or components of "var1"&amp;nbsp; or that there is no match in any of the components in both variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; The start date for "var2" is 30 days after the start date for "var1".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, the table I want is,&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Person ID&lt;/TD&gt;&lt;TD&gt;var1&lt;/TD&gt;&lt;TD&gt;v1_start date&lt;/TD&gt;&lt;TD&gt;WANT&lt;/TD&gt;&lt;TD&gt;v2_start date&lt;/TD&gt;&lt;TD&gt;v2_end date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Dog+Pig&lt;/TD&gt;&lt;TD&gt;01/18/2018&lt;/TD&gt;&lt;TD&gt;lion&lt;/TD&gt;&lt;TD&gt;10/04/2018&lt;/TD&gt;&lt;TD&gt;11/15/2018&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The method I tried so far is to mark whether to keep or remove based on the conditions I set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;CREATE TABLE want AS&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;SELECT personid, var1, v1_startdate, var2, v2_startdate,&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;(Case when&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;(v2_startdate &amp;gt; v1_startdate+30) &amp;amp; (var2 &amp;lt;&amp;gt; va1)) THEN 1 ELSE 0 END) AS KEEEP&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;FROM have&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;GROUP BY personid;&lt;/P&gt;&lt;P&gt;QUIT;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you need any clarification!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 01:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807522#M318391</guid>
      <dc:creator>jsyang56</dc:creator>
      <dc:date>2022-04-13T01:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I identify that components of one column does not match the components in another column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807525#M318394</link>
      <description>&lt;P&gt;How about this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if (v2_startdate &amp;gt; v1_startdate+30) and (find(var1,var2,'it')=0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 01:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807525#M318394</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-04-13T01:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I identify that components of one column does not match the components in another column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807528#M318395</link>
      <description>&lt;P&gt;It worked! I really appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just so that I have a good understanding of what happened, what does 'it' do when it's in the function of FIND()? I never thought about trying out this way nor seen other responses.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 01:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807528#M318395</guid>
      <dc:creator>jsyang56</dc:creator>
      <dc:date>2022-04-13T01:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I identify that components of one column does not match the components in another column?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807535#M318401</link>
      <description>&lt;P&gt;"i or I"&amp;nbsp;&lt;SPAN&gt;ignores character case during the search. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this modifier is not specified, FIND cannot searches "dog" in "Dog"&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;find(var1,var2,'i')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;is same like&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;find(upcase(var1),upcase(var2))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"t or T" trims trailing blanks from&amp;nbsp;string&amp;nbsp;and&amp;nbsp;substring.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;If var1 or var2 has a long variable length, such as $100, it must be trimmed to include trailing blanks in the search.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;find(var1,var2,'t')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is same as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;find(trim(var1),trim(var2))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmcdc/8.11/proccas/n0kcfmf5agtudun1v1zkvnbd7970.htm#p0nrqrc08pbr39n19trn9limhs6e" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmcdc/8.11/proccas/n0kcfmf5agtudun1v1zkvnbd7970.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 02:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-identify-that-components-of-one-column-does-not-match/m-p/807535#M318401</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-04-13T02:40:36Z</dc:date>
    </item>
  </channel>
</rss>

