<?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: compare the names in the same dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825306#M35209</link>
    <description>&lt;P&gt;Something like this perhaps:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   if upcase(mom)=upcase(mom_new) then Check_mom='Correct';
   else Check_mom='Wrong';
run;&lt;/PRE&gt;
&lt;P&gt;Same logic for dad.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: In the long run with SAS you may find that getting a True/False, Yes/No, Right/wrong comparison is better as the numeric 1 (True or yes or correct) and 0 (false no wrong ) in the long run. You can use a format to display any desired text but counting and reporting rates is often much easier with numeric values. Since SAS will return 1/0 as the result of logical comparisons the above code using that coding would be:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   Check_mom = (upcase(mom)=upcase(mom_new));
run;&lt;/PRE&gt;</description>
    <pubDate>Mon, 25 Jul 2022 16:52:52 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-07-25T16:52:52Z</dc:date>
    <item>
      <title>compare the names in the same dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825291#M35208</link>
      <description>&lt;P&gt;&amp;nbsp;I have a dataset A and want to compare mom vs mom_new and dad vs dad_new and comment&lt;/P&gt;&lt;P&gt;check_mom and check_dad. if the names are correct or wrong like follows&lt;/P&gt;&lt;P&gt;Mom&amp;nbsp; Dad&amp;nbsp; &amp;nbsp; Mom_new&amp;nbsp; &amp;nbsp; Dad_new&amp;nbsp; &amp;nbsp; Check_mom&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Check_dad&lt;/P&gt;&lt;P&gt;abc&amp;nbsp; &amp;nbsp; &amp;nbsp;dher&amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dher&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; correct&lt;/P&gt;&lt;P&gt;Bcd&amp;nbsp; &amp;nbsp; &amp;nbsp;sher&amp;nbsp; &amp;nbsp; &amp;nbsp;bcd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SHER&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;correct&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;correct&lt;/P&gt;&lt;P&gt;Fer&amp;nbsp; &amp;nbsp; &amp;nbsp; Sta&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Far&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sta&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wrong&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;correct&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 16:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825291#M35208</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2022-07-25T16:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: compare the names in the same dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825306#M35209</link>
      <description>&lt;P&gt;Something like this perhaps:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   if upcase(mom)=upcase(mom_new) then Check_mom='Correct';
   else Check_mom='Wrong';
run;&lt;/PRE&gt;
&lt;P&gt;Same logic for dad.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: In the long run with SAS you may find that getting a True/False, Yes/No, Right/wrong comparison is better as the numeric 1 (True or yes or correct) and 0 (false no wrong ) in the long run. You can use a format to display any desired text but counting and reporting rates is often much easier with numeric values. Since SAS will return 1/0 as the result of logical comparisons the above code using that coding would be:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   Check_mom = (upcase(mom)=upcase(mom_new));
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jul 2022 16:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825306#M35209</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-25T16:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: compare the names in the same dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825311#M35210</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql;
   create table want as
   select *, case when lowcase(mom) = lowcase(mom_new) then 'correct' else 'wrong' end as Check_mom
   from A;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am inferring from the example data that differences in letter case are not to be used to signify a non-match. If that is incorrect, then this code will fail.&lt;/P&gt;&lt;P&gt;The CASE WHEN statement should illustrate how to do this for the "mom" variables, and it should be simple to add another CASE WHEN statement for the other two variables that need this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This could also be done with a DATA step with a different syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2022 17:02:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/compare-the-names-in-the-same-dataset/m-p/825311#M35210</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2022-07-25T17:02:48Z</dc:date>
    </item>
  </channel>
</rss>

