<?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: remove duplicates based on two variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308429#M66187</link>
    <description>&lt;PRE&gt;

proc import datafile='c:\temp\_biVar_all_correlations_b.csv' out=have dbms=csv replace;
run;
data temp;
 set have;
 length new1 new2 $ 40;
 new1=depvar1;
 new2=depvar2;
 call sortc(new1,new2);
run;
proc sort data=temp out=want nodupkey;
by new1 new2;
run;


&lt;/PRE&gt;</description>
    <pubDate>Tue, 01 Nov 2016 04:42:13 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-11-01T04:42:13Z</dc:date>
    <item>
      <title>remove duplicates based on two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308287#M66135</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have several CSV files that contain correlations between two variables. These correlations were computed using twin modelling in R. The name of the two variables are in column &lt;STRONG&gt;depVar1&lt;/STRONG&gt; and &lt;STRONG&gt;depVar2&lt;/STRONG&gt;. An example of duplication here is that the correlation between A and B duplicates the correlation between B and A:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;depVar1&lt;/STRONG&gt;=A,&amp;nbsp;&lt;STRONG&gt;depVar2&lt;/STRONG&gt;=B&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;depVar1&lt;/STRONG&gt;=B,&amp;nbsp;&lt;STRONG&gt;depVar2&lt;/STRONG&gt;=A (this is a duplicate of the above)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To illustrate, I've groupped some rows by color and bold their duplicates as shown by the screenshot belows. Not all the duplicated rows are bold. However, values from column D to column K are the same in duplicated rows. I thought of removing duplicated rows by column D~ K. However, this is risky because different combinations of 2 variables can have same correlations. My data have been attached. There are 20 rows in the data. There should be 10 rows left after the removal of the duplicates. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5578i347160CAE4D01520/image-size/original?v=v2&amp;amp;px=-1" alt="duplicates_in_bivariate_modelling.png" title="duplicates_in_bivariate_modelling.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chang&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308287#M66135</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2016-10-31T14:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: remove duplicates based on two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308289#M66137</link>
      <description>&lt;P&gt;If you always have the matching pair in your data, it should be easy to code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if depvar1 &amp;gt; depvar2 then delete;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 14:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308289#M66137</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-31T14:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: remove duplicates based on two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308429#M66187</link>
      <description>&lt;PRE&gt;

proc import datafile='c:\temp\_biVar_all_correlations_b.csv' out=have dbms=csv replace;
run;
data temp;
 set have;
 length new1 new2 $ 40;
 new1=depvar1;
 new2=depvar2;
 call sortc(new1,new2);
run;
proc sort data=temp out=want nodupkey;
by new1 new2;
run;


&lt;/PRE&gt;</description>
      <pubDate>Tue, 01 Nov 2016 04:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308429#M66187</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-01T04:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: remove duplicates based on two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308692#M66276</link>
      <description>&lt;P&gt;Thanks. That's an elegant solution!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 07:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/remove-duplicates-based-on-two-variables/m-p/308692#M66276</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2016-11-02T07:28:36Z</dc:date>
    </item>
  </channel>
</rss>

