<?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 two or more columns in two dataset and add one more field with 1 or 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438582#M109369</link>
    <description>&lt;P&gt;I'm interpreting the problem slightly differently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=test1;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=test2;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge test1 (rename=(name=name1))&lt;/P&gt;
&lt;P&gt;test2 (rename=(name=name2));&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;action_flag = (name1=name2);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2018 09:26:39 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-02-20T09:26:39Z</dc:date>
    <item>
      <title>Compare two or more columns in two dataset and add one more field with 1 or 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438574#M109365</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've two datasets , called test1 and test2 , i want to create one more dataset based upon "name" fields with all the data of test1 and test2. I want to add one more field like "action_flag"&amp;nbsp; with value 1 or 0. if name match then action_flag=1 else 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;input id name $;&lt;BR /&gt;cards;&lt;BR /&gt;1 ab&lt;BR /&gt;2 cf&lt;BR /&gt;3 er&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data test2;&lt;BR /&gt;input id name $;&lt;BR /&gt;cards;&lt;BR /&gt;1 ab&lt;BR /&gt;2 df&lt;BR /&gt;3 er&lt;BR /&gt;4 hj&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 09:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438574#M109365</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2018-02-20T09:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two or more columns in two dataset and add one more field with 1 or 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438576#M109366</link>
      <description>&lt;PRE&gt;proc sort data=test1;
  by name;
run;
proc sort data=test2;
  by name;
run;
data want;
  merge test1 (in=a) test2 (in=b);
  by name;
  action_flag=ifn(a and b,1,0);
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Feb 2018 09:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438576#M109366</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-20T09:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two or more columns in two dataset and add one more field with 1 or 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438582#M109369</link>
      <description>&lt;P&gt;I'm interpreting the problem slightly differently:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=test1;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;proc sort data=test2;&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge test1 (rename=(name=name1))&lt;/P&gt;
&lt;P&gt;test2 (rename=(name=name2));&lt;/P&gt;
&lt;P&gt;by id;&lt;/P&gt;
&lt;P&gt;action_flag = (name1=name2);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 09:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compare-two-or-more-columns-in-two-dataset-and-add-one-more/m-p/438582#M109369</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-02-20T09:26:39Z</dc:date>
    </item>
  </channel>
</rss>

