<?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 How to keep data from two matching variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810000#M319423</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var1&amp;nbsp; &amp;nbsp; var2&lt;/P&gt;&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to keep only the data points that match, such as when var1 and var2 both have a value of 3, and I can get rid of the rest of the data. How could I do this?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2022 19:43:42 GMT</pubDate>
    <dc:creator>sdevenny</dc:creator>
    <dc:date>2022-04-26T19:43:42Z</dc:date>
    <item>
      <title>How to keep data from two matching variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810000#M319423</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var1&amp;nbsp; &amp;nbsp; var2&lt;/P&gt;&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to keep only the data points that match, such as when var1 and var2 both have a value of 3, and I can get rid of the rest of the data. How could I do this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 19:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810000#M319423</guid>
      <dc:creator>sdevenny</dc:creator>
      <dc:date>2022-04-26T19:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep data from two matching variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810001#M319424</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if var1=var2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/344422"&gt;@sdevenny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data looks something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var1&amp;nbsp; &amp;nbsp; var2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to keep only the data points that match, such as when var1 and var2 both have a value of 3, and I can get rid of the rest of the data. How could I do this?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 19:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810001#M319424</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-04-26T19:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep data from two matching variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810060#M319440</link>
      <description>&lt;P&gt;Since all values for the condition are contained in the incoming dataset, you can use WHERE in its different forms as statement, dataset option or SQL clause:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
where var1 = var2;
run;

data want;
set have (where=(var1 = var2));
run;

proc sql;
create table want as
  select * 
  from have
  where var1 = var2
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Apr 2022 04:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-keep-data-from-two-matching-variables/m-p/810060#M319440</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-27T04:40:42Z</dc:date>
    </item>
  </channel>
</rss>

