<?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: Finding unmatched variables (name/dob/enroll)? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673569#M202660</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp; Assuming I understand your requirement, the following should do?-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
	infile datalines dsd;
	format ID 2. first_name $10. last_name $10. birthdate mmddyy10. enroll $1.;
 	input ID : 2. first_name : $10. last_name : $10. birthdate : mmddyy10. enroll : $1.;
datalines;
1,  John, Doe,   01/01/2020, Y,
12,  John, Doe,   01/01/2020, N,
2,  Joe,  Smith, 12/01/2019, Y,
22,  Joe,  Smith, 12/01/2019, Y,
27,  Joe,  Smith, 12/01/2019, Y,
32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,
24,  Beky,   Lee, 08/23/2005, N,
41,  Beky,   Lee, 08/21/2005, N,
48,  Beky,   Lee, 08/23/2005, N,
49,  Beky,   Lee, 08/23/2005, Y,
15,	Ashley, Taylor, 09/18/2000, N,
54,	Ashley, Taylor, 09/18/2000, N,
65,	Ashley, Taylor, 09/18/2000, N,
;
run;


proc sql;
create table want as
select *
from have
group by first_name,last_name,birthdate,enroll
having count(*)=1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 Jul 2020 20:49:10 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-07-30T20:49:10Z</dc:date>
    <item>
      <title>Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673542#M202644</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have dataset list below.&lt;/P&gt;
&lt;PRE&gt;data have;
	infile datalines dsd;
	format ID 2. first_name $10. last_name $10. birthdate mmddyy10. enroll $1.;
 	input ID : 2. first_name : $10. last_name : $10. birthdate : mmddyy10. enroll : $1.;
datalines;
1,  John, Doe,   01/01/2020, Y,
12,  John, Doe,   01/01/2020, N,
2,  Joe,  Smith, 12/01/2019, Y,
22,  Joe,  Smith, 12/01/2019, Y,
27,  Joe,  Smith, 12/01/2019, Y,
32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,
24,  Beky,   Lee, 08/23/2005, N,
41,  Beky,   Lee, 08/21/2005, N,
48,  Beky,   Lee, 08/23/2005, N,
49,  Beky,   Lee, 08/23/2005, Y,
15,	Ashley, Taylor, 09/18/2000, N,
54,	Ashley, Taylor, 09/18/2000, N,
65,	Ashley, Taylor, 09/18/2000, N,
;
run;&lt;/PRE&gt;
&lt;P&gt;I would like to list all the unmatching names/dob/enroll as the result shown below.&amp;nbsp;&amp;nbsp; Please advice how to approach it, thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
	infile datalines dsd;
	format ID 2. first_name $10. last_name $10. birthdate mmddyy10. enroll $1.;
 	input ID : 2. first_name : $10. last_name : $10. birthdate : mmddyy10. enroll : $1.;
datalines;
1,  John, Doe,   01/01/2020, Y,
12,  John, Doe,   01/01/2020, N,
27,  Joe,  Smith, 12/01/2019, Y,
32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,
24,  Beky,   Lee, 08/23/2005, N,
41,  Beky,   Lee, 08/21/2005, N,
48,  Beky,   Lee, 08/23/2005, N,
49,  Beky,   Lee, 08/23/2005, Y,
;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 19:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673542#M202644</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-30T19:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673543#M202645</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I would like to list all the unmatching names/dob/enroll as the result shown below.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;This is a really brief description, could you please elaborate and explain the logic you want to follow?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is Joe Smith in the output data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is this in the output data set?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;48,  Beky,   Lee, 08/23/2005, N,&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 19:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673543#M202645</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-30T19:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673548#M202647</link>
      <description>PTOC SQL;&lt;BR /&gt;CREATE TABLE want AS&lt;BR /&gt;SELECT COUNT(*) AS nbr_doublon, firstname, lastname, birthdate,enroll&lt;BR /&gt;FROM have&lt;BR /&gt;GROUP BY firstname, lastname, birthdate,enroll&lt;BR /&gt;HAVING COUNT(*) =1;&lt;BR /&gt;QUIT;&lt;BR /&gt;&lt;BR /&gt;ALTER TABLE want&lt;BR /&gt;DROP COLUMN nbr_doublon;</description>
      <pubDate>Thu, 30 Jul 2020 19:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673548#M202647</guid>
      <dc:creator>mazouz</dc:creator>
      <dc:date>2020-07-30T19:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673555#M202654</link>
      <description>Your result dataset is missing ID which I would like to include the final dataset.</description>
      <pubDate>Thu, 30 Jul 2020 19:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673555#M202654</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-30T19:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673557#M202656</link>
      <description>Sorry, my mistake.  The '27,  Joe,  Smith, 12/01/2019, Y,' should not be in the final dataset.</description>
      <pubDate>Thu, 30 Jul 2020 19:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673557#M202656</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-30T19:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673559#M202658</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Try this, I don't have sas now to try the code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PROC SQL;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CREATE TABLE want AS&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT ID, firstname, lastname, birthdate,enroll,COUNT(firstname, lastname, birthdate,enroll) AS nbr_doublon&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FROM have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GROUP BY firstname, lastname, birthdate,enroll&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;HAVING nbr_doublon =1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;QUIT;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ALTER TABLE want&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DROP COLUMN nbr_doublon;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 20:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673559#M202658</guid>
      <dc:creator>mazouz</dc:creator>
      <dc:date>2020-07-30T20:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673565#M202659</link>
      <description>Not working, see below.&lt;BR /&gt;&lt;BR /&gt;WARNING: Function COUNT requires at most 3 argument(s). The extra one(s) will be ignored.&lt;BR /&gt;ERROR: Function COUNT requires a character expression as argument 3.&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jul 2020 20:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673565#M202659</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-30T20:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673569#M202660</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp; Assuming I understand your requirement, the following should do?-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
	infile datalines dsd;
	format ID 2. first_name $10. last_name $10. birthdate mmddyy10. enroll $1.;
 	input ID : 2. first_name : $10. last_name : $10. birthdate : mmddyy10. enroll : $1.;
datalines;
1,  John, Doe,   01/01/2020, Y,
12,  John, Doe,   01/01/2020, N,
2,  Joe,  Smith, 12/01/2019, Y,
22,  Joe,  Smith, 12/01/2019, Y,
27,  Joe,  Smith, 12/01/2019, Y,
32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,
24,  Beky,   Lee, 08/23/2005, N,
41,  Beky,   Lee, 08/21/2005, N,
48,  Beky,   Lee, 08/23/2005, N,
49,  Beky,   Lee, 08/23/2005, Y,
15,	Ashley, Taylor, 09/18/2000, N,
54,	Ashley, Taylor, 09/18/2000, N,
65,	Ashley, Taylor, 09/18/2000, N,
;
run;


proc sql;
create table want as
select *
from have
group by first_name,last_name,birthdate,enroll
having count(*)=1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 20:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673569#M202660</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-07-30T20:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673575#M202663</link>
      <description>&lt;P&gt;Although the code is working, the 'Becky' only have two.&amp;nbsp;&amp;nbsp; My final 'want' dataset have four 'Becky's.&amp;nbsp; I would like to have all of the IDs for 'Becky.'&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 21:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673575#M202663</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-30T21:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673585#M202665</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;create table want1 as&lt;BR /&gt;select *&lt;BR /&gt;from have&lt;BR /&gt;group by first_name,last_name,birthdate,enroll&lt;BR /&gt;having count(*)=1 ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table want2 as&lt;BR /&gt;select *&lt;BR /&gt;from have&lt;BR /&gt;group by first_name,last_name,birthdate,enroll&lt;BR /&gt;having count(*)&amp;gt;1 ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select *&lt;BR /&gt;from want1 t1&lt;BR /&gt;left join want2 t2&lt;BR /&gt;on (t1.first_name=t2.first_name and t1.last_name=t2.last_name and t1.birthdate=t2.birthdate);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc delete data=want1 want2 (gennum=all);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 22:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673585#M202665</guid>
      <dc:creator>mazouz</dc:creator>
      <dc:date>2020-07-30T22:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673673#M202708</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;, you've provided extremely brief information about the logic you are using, and we can't really understand the logic you want to use. Please take some time and describe in words, and in detail, what your logic is that takes you from the input data to the output data. These terribly brief statements of yours simply are not moving us forward.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 11:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673673#M202708</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-31T11:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673699#M202717</link>
      <description>&lt;P&gt;How do you know&lt;/P&gt;
&lt;PRE&gt;32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,&lt;/PRE&gt;
&lt;P&gt;is the same person , but have different last name ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming the first name is the same for the same person .&lt;/P&gt;
&lt;PRE&gt;data have;
	infile datalines dsd;
	format ID 2. first_name $10. last_name $10. birthdate mmddyy10. enroll $1.;
 	input ID : 2. first_name : $10. last_name : $10. birthdate : mmddyy10. enroll : $1.;
datalines;
1,  John, Doe,   01/01/2020, Y,
12,  John, Doe,   01/01/2020, N,
2,  Joe,  Smith, 12/01/2019, Y,
22,  Joe,  Smith, 12/01/2019, Y,
27,  Joe,  Smith, 12/01/2019, Y,
32,  Kevin,  Mao, 02/06/2000, N,
36,  Kevin,  Yao, 02/06/2000, Y,
24,  Beky,   Lee, 08/23/2005, N,
41,  Beky,   Lee, 08/21/2005, N,
48,  Beky,   Lee, 08/23/2005, N,
49,  Beky,   Lee, 08/23/2005, Y,
15,	Ashley, Taylor, 09/18/2000, N,
54,	Ashley, Taylor, 09/18/2000, N,
65,	Ashley, Taylor, 09/18/2000, N,
;
run;
proc sql;
create table want as
select *
 from have 
  group by first_name
   having count(distinct catx('|', last_name,birthdate,enroll )) ne 1;
quit;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 12:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673699#M202717</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-07-31T12:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673723#M202727</link>
      <description>&lt;P&gt;Sorry for the confusion,&amp;nbsp;&amp;nbsp; I am looking for the&amp;nbsp;IDs&amp;nbsp;whose&amp;nbsp;any first_name/last_name/dob/enroll is different.&amp;nbsp;&amp;nbsp; Therefore, when 'Joe Smith' and 'Ashley Taylor' have the&amp;nbsp;same name, DOB and enroll,&lt;U&gt; I don't need them&lt;/U&gt;.&amp;nbsp;&amp;nbsp; All the rest are the IDs I am looking for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 14:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673723#M202727</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-07-31T14:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Finding unmatched variables (name/dob/enroll)?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673726#M202729</link>
      <description>proc sql;&lt;BR /&gt;create table want1 as&lt;BR /&gt;select *&lt;BR /&gt;from have&lt;BR /&gt;group by first_name,last_name,birthdate,enroll&lt;BR /&gt;having count(*)=1 ;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table want2 as&lt;BR /&gt;select *&lt;BR /&gt;from have&lt;BR /&gt;group by first_name,last_name,birthdate,enroll&lt;BR /&gt;having count(*)&amp;gt;1 ;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select *&lt;BR /&gt;from want1 t1&lt;BR /&gt;left join want2 t2&lt;BR /&gt;on (t1.first_name=t2.first_name and t1.last_name=t2.last_name );&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc delete data=want1 want2 (gennum=all);&lt;BR /&gt;run;</description>
      <pubDate>Fri, 31 Jul 2020 14:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-unmatched-variables-name-dob-enroll/m-p/673726#M202729</guid>
      <dc:creator>mazouz</dc:creator>
      <dc:date>2020-07-31T14:40:18Z</dc:date>
    </item>
  </channel>
</rss>

