<?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: Comparing 2 dataset by Age in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-2-dataset-by-Age/m-p/829692#M327808</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select
    data2.*
    ,case when data2.age between data1.age_1 and data1.age_2 then 1 else 0 end as flag
    from data1 left join data2
    on upcase(data1.name)=upcase(data2.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code is untested, you need to provide data as &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code for it to be tested.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Aug 2022 16:21:42 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-08-22T16:21:42Z</dc:date>
    <item>
      <title>Comparing 2 dataset by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-2-dataset-by-Age/m-p/829690#M327806</link>
      <description>Dear Team,&lt;BR /&gt;I want to compare two dataset. I have mentioned below by Example,&lt;BR /&gt;Data 1: (Age_1 = Age - 5,  Age_2= Age +5 )&lt;BR /&gt;NAME.   AGE.     Age_1.      Age_2 &lt;BR /&gt;ABC         25.        20.           30&lt;BR /&gt;Xyz.          20.        15.            25&lt;BR /&gt;&lt;BR /&gt;Data 2:&lt;BR /&gt;Name.       Age.    &lt;BR /&gt;ABC.          27&lt;BR /&gt;XYZ.             22&lt;BR /&gt;&lt;BR /&gt;Problem:&lt;BR /&gt;If data2.Age value is between the data1.age_1 and data1.age_2. then one flag will create. Otherwise flag 0. Like this condition I am unable to do. Please suggest how to do this type of problem ?</description>
      <pubDate>Mon, 22 Aug 2022 16:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-2-dataset-by-Age/m-p/829690#M327806</guid>
      <dc:creator>Shakti_Sourav</dc:creator>
      <dc:date>2022-08-22T16:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing 2 dataset by Age</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-2-dataset-by-Age/m-p/829692#M327808</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select
    data2.*
    ,case when data2.age between data1.age_1 and data1.age_2 then 1 else 0 end as flag
    from data1 left join data2
    on upcase(data1.name)=upcase(data2.name);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code is untested, you need to provide data as &lt;FONT color="#FF0000"&gt;working&lt;/FONT&gt; SAS data step code for it to be tested.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 16:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-2-dataset-by-Age/m-p/829692#M327808</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-22T16:21:42Z</dc:date>
    </item>
  </channel>
</rss>

