<?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: Pick Unique ID per Unique ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588711#M168290</link>
    <description>&lt;P&gt;So do you want to resolve this problem in your initial join or from &lt;EM&gt;have&lt;/EM&gt; to &lt;EM&gt;want&lt;/EM&gt;?&lt;/P&gt;</description>
    <pubDate>Sat, 14 Sep 2019 08:41:31 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-09-14T08:41:31Z</dc:date>
    <item>
      <title>Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588708#M168288</link>
      <description>&lt;P&gt;HI All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data set where I've matched on customer number (CRN), date (idate) and amount (fullpay) from two tables which has created a many to many data set where there are same payments on the same day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if there were 3 payments in my full payment table and 3 payments in my deduction table I get nine lines (see below). Is there a way I can get a unique MATCH_ID for each unique PAID_ID?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	length crn paid_id match_id fullpay deduct issued idate 8;
	informat idate anydtdte21.;
	format idate ddmmyy10.;
	infile datalines delimiter=',';
	input crn paid_id match_id fullpay deduct issued idate;
	datalines;
123456,4471,53360,66.03,66.03,0,5/09/2019
123456,4471,53361,66.03,41.07,24.96,5/09/2019
123456,4471,53362,66.03,0,66.03,5/09/2019
123456,4472,53360,66.03,66.03,0,5/09/2019
123456,4472,53361,66.03,41.07,24.96,5/09/2019
123456,4472,53362,66.03,0,66.03,5/09/2019
123456,4473,53360,66.03,66.03,0,5/09/2019
123456,4473,53361,66.03,41.07,24.96,5/09/2019
123456,4473,53362,66.03,0,66.03,5/09/2019
654321,11827,184385,57.4,16.8,40.6,15/03/2019
654321,11828,184385,57.4,16.8,40.6,15/03/2019
654321,11826,184385,57.4,16.8,40.6,15/03/2019
654321,11827,184384,57.4,57.4,0,15/03/2019
654321,11828,184384,57.4,57.4,0,15/03/2019
654321,11826,184384,57.4,57.4,0,15/03/2019
654321,11827,184383,57.4,57.4,0,15/03/2019
654321,11828,184383,57.4,57.4,0,15/03/2019
654321,11826,184383,57.4,57.4,0,15/03/2019
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and this is what I need:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	length crn paid_id match_id fullpay deduct issued idate 8;
	informat idate anydtdte21.;
	format idate ddmmyy10.;
	infile datalines delimiter=',';
	input crn paid_id match_id fullpay deduct issued idate;
	datalines;
123456,4471,53360,66.03,66.03,0,5/09/2019
123456,4472,53361,66.03,41.07,24.96,5/09/2019
123456,4473,53362,66.03,0,66.03,5/09/2019
654321,11826,184383,57.4,57.4,0,15/03/2019
654321,11827,184384,57.4,57.4,0,15/03/2019
654321,11828,184385,57.4,16.8,40.6,15/03/2019
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any help gratefully received and many thanks in advance&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 08:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588708#M168288</guid>
      <dc:creator>SteveNZ</dc:creator>
      <dc:date>2019-09-14T08:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588710#M168289</link>
      <description>&lt;P&gt;I guess this should be fixed while you do the initial join. Could you show us the corresponding entries in the two tables from which you created "have"?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 08:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588710#M168289</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-14T08:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588711#M168290</link>
      <description>&lt;P&gt;So do you want to resolve this problem in your initial join or from &lt;EM&gt;have&lt;/EM&gt; to &lt;EM&gt;want&lt;/EM&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 08:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588711#M168290</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-14T08:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588712#M168291</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21489"&gt;@SteveNZ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really appreciate that you've posted the data as working SAS data steps.&lt;/P&gt;
&lt;P&gt;You need to fix the join so that it's no more many:many&lt;/P&gt;
&lt;P&gt;For your sample data show us what you've got in the two source tables.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 08:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588712#M168291</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-14T08:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588715#M168294</link>
      <description>&lt;P&gt;please try below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
by idate crn match_id  ;
run;

data want;
set have;
by idate crn match_id ;
if first.match_id;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Sep 2019 09:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588715#M168294</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-14T09:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pick Unique ID per Unique ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588770#M168320</link>
      <description>&lt;P&gt;Hi Jag,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This appears to have solved it at first glance (large amount of data). Thanks so much, I think I was over complicating things a bit my end but running your code seems to do the trick!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Sat, 14 Sep 2019 21:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pick-Unique-ID-per-Unique-ID/m-p/588770#M168320</guid>
      <dc:creator>SteveNZ</dc:creator>
      <dc:date>2019-09-14T21:29:01Z</dc:date>
    </item>
  </channel>
</rss>

