<?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 Scanning or coalesce to find match in data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Scanning-or-coalesce-to-find-match-in-data/m-p/745257#M233575</link>
    <description>&lt;PRE&gt;data have1;
 length loan_num $10
 	curr_phone $10
	;
	input loan_num curr_phone;
datalines;
2234110000 1111111111 
3400238190 9981111111 
2098766890 0 

;
run;

data have2;
 length loan_num $10
	phone1 $10 
	alt_phone $10
	bus_phone $10;
	input loan_num -- bus_phone;
datalines;
2234110000 1111111111 0 3333333333 
3400238190 3323333333 1098899999 0 
2098766890 0 2234444444 0  

;
run;

proc sql;
create table have3 as
select *,case when curr_phone in coalesce(phone1,alt_phone,bus_phone)
then 'Y' end as Phone_Match
from have1		a
left join have2	b
on a.loan_num=b.loan_num
;quit;&lt;/PRE&gt;
&lt;P&gt;I am comparing two sets of data (have1 and have2)&amp;nbsp; When I combine the two in have3 I tried to use a coalesce to look for a match between curr_phone(have1) and&amp;nbsp; &amp;nbsp;phone1,alt_phone or bus_phone.(have2)&amp;nbsp; If there is a match with any of the three I want to designate with a 'Y'.&amp;nbsp; When I try and use coalesce I get an error.&amp;nbsp; Would I need to use some type of scan of all three phone numbers or am I just using coalesce incorrectly?&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 17:54:15 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2021-06-02T17:54:15Z</dc:date>
    <item>
      <title>Scanning or coalesce to find match in data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scanning-or-coalesce-to-find-match-in-data/m-p/745257#M233575</link>
      <description>&lt;PRE&gt;data have1;
 length loan_num $10
 	curr_phone $10
	;
	input loan_num curr_phone;
datalines;
2234110000 1111111111 
3400238190 9981111111 
2098766890 0 

;
run;

data have2;
 length loan_num $10
	phone1 $10 
	alt_phone $10
	bus_phone $10;
	input loan_num -- bus_phone;
datalines;
2234110000 1111111111 0 3333333333 
3400238190 3323333333 1098899999 0 
2098766890 0 2234444444 0  

;
run;

proc sql;
create table have3 as
select *,case when curr_phone in coalesce(phone1,alt_phone,bus_phone)
then 'Y' end as Phone_Match
from have1		a
left join have2	b
on a.loan_num=b.loan_num
;quit;&lt;/PRE&gt;
&lt;P&gt;I am comparing two sets of data (have1 and have2)&amp;nbsp; When I combine the two in have3 I tried to use a coalesce to look for a match between curr_phone(have1) and&amp;nbsp; &amp;nbsp;phone1,alt_phone or bus_phone.(have2)&amp;nbsp; If there is a match with any of the three I want to designate with a 'Y'.&amp;nbsp; When I try and use coalesce I get an error.&amp;nbsp; Would I need to use some type of scan of all three phone numbers or am I just using coalesce incorrectly?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 17:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scanning-or-coalesce-to-find-match-in-data/m-p/745257#M233575</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2021-06-02T17:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scanning or coalesce to find match in data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scanning-or-coalesce-to-find-match-in-data/m-p/745262#M233579</link>
      <description>WHICHC() function. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scanning-or-coalesce-to-find-match-in-data/m-p/745262#M233579</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-02T18:05:58Z</dc:date>
    </item>
  </channel>
</rss>

