<?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 sql contains in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139649#M261452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a following dataset A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="415"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" width="91"&gt;id&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="68"&gt;date&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="256"&gt;code&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;19075F106&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="23" style="border-top: none;" width="91"&gt;6219640&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;n10,v10,x10,w10,n1010,v1010,x1010,w1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="23" style="border-top: none;" width="91"&gt;6366007&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;s10,v10,s1010,v1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;B63FY34&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;25179M103&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;&lt;P&gt;a10,axau10,a1010,axau1010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another dataset B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="163"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="23" width="99"&gt;date&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;code&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;x1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;w10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to filter dataset A where the code is contained in dataset B. The resulting dataset should be the below. I am trying to use SQL contains but its not working.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="159" style="width: 782px; height: 165px;" width="780"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl67" height="23" width="64"&gt;id&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="85"&gt;date&lt;/TD&gt;&lt;TD class="xl68" style="border-left: none;" width="289"&gt;code&lt;/TD&gt;&lt;TD class="xl70" width="64"&gt;newcode&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;19075F106&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="64"&gt;6219640&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;n10,v10,x10,w10,n1010,v1010,x1010,w1010&lt;/TD&gt;&lt;TD&gt;x1010, w10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;B63FY34&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;25179M103&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Apr 2014 17:41:22 GMT</pubDate>
    <dc:creator>hdg</dc:creator>
    <dc:date>2014-04-30T17:41:22Z</dc:date>
    <item>
      <title>sql contains</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139649#M261452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a following dataset A&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="415"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" width="91"&gt;id&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="68"&gt;date&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="256"&gt;code&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;19075F106&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="23" style="border-top: none;" width="91"&gt;6219640&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;n10,v10,x10,w10,n1010,v1010,x1010,w1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="23" style="border-top: none;" width="91"&gt;6366007&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;s10,v10,s1010,v1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;B63FY34&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl63" height="23" style="border-top: none;" width="91"&gt;25179M103&lt;/TD&gt;&lt;TD align="right" class="xl64" style="border-top: none; border-left: none;" width="68"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;" width="256"&gt;&lt;P&gt;a10,axau10,a1010,axau1010&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another dataset B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="163"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="23" width="99"&gt;date&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;code&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;x1010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="99"&gt;4/29/2014&lt;/TD&gt;&lt;TD&gt;w10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to filter dataset A where the code is contained in dataset B. The resulting dataset should be the below. I am trying to use SQL contains but its not working.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="159" style="width: 782px; height: 165px;" width="780"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl67" height="23" width="64"&gt;id&lt;/TD&gt;&lt;TD class="xl67" style="border-left: none;" width="85"&gt;date&lt;/TD&gt;&lt;TD class="xl68" style="border-left: none;" width="289"&gt;code&lt;/TD&gt;&lt;TD class="xl70" width="64"&gt;newcode&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;19075F106&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="23" style="border-top: none;" width="64"&gt;6219640&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;n10,v10,x10,w10,n1010,v1010,x1010,w1010&lt;/TD&gt;&lt;TD&gt;x1010, w10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;B63FY34&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="23" style="border-top: none;" width="64"&gt;25179M103&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;" width="85"&gt;4/29/2014&lt;/TD&gt;&lt;TD class="xl69" style="border-top: none; border-left: none;" width="289"&gt;a10,axau10,a1010,axau1010&lt;/TD&gt;&lt;TD&gt;a10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2014 17:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139649#M261452</guid>
      <dc:creator>hdg</dc:creator>
      <dc:date>2014-04-30T17:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: sql contains</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139650#M261453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Post your code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2014 17:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139650#M261453</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-30T17:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: sql contains</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139651#M261454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From I can see ( well I could be way off ), even though your problem seems to hint some sort of Cartesian Product approach,&amp;nbsp; this is still not a good candidate for Proc SQL, because Catenate functions are NOT supported to operate across the rows. On the other hand, Data step can be more resourceful using Hash or Point=. The following is an old school approach using Point=;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'09'x&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; id &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$20.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$50.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; id date code;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;19075F106&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;6219640&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; n10,v10,x10,w10,n1010,v1010,x1010,w1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;6366007&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; s10,v10,s1010,v1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B63FY34&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;25179M103&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; B;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;truncover&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'09'x&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; code &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$8.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date code;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;mmddyy10.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4/29/2014&amp;nbsp; a10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4/29/2014&amp;nbsp; a10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4/29/2014&amp;nbsp; a10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4/29/2014&amp;nbsp; x1010&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;4/29/2014&amp;nbsp; w10&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'nobs'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,nobs);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; b &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;nobs&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=nobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; new_code $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; _cd (&amp;amp;nobs)&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*arbituary*/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;20&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;nobs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; b (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;rename&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=code=b_code &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=code) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;point&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; findw(code,strip(b_code))&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; strip(b_code) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; in _cd &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; _cd(i)=b_code;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new_code=catx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, of _cd(*));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;not&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; missing (new_code);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; _cd: b_code;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2014 18:42:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139651#M261454</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-04-30T18:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: sql contains</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139652#M261455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think so. Cartesian Product of Data step can't compete SQL's at all. Yours is very very slowly .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data a;
infile cards truncover ;
informat&amp;nbsp;&amp;nbsp; id $20.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date mmddyy10.&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code $50.;
input id date code;
format date mmddyy10.;
cards;
19075F106&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010
6219640&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; n10,v10,x10,w10,n1010,v1010,x1010,w1010
6366007&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; s10,v10,s1010,v1010
B63FY34&amp;nbsp;&amp;nbsp;&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010
25179M103&amp;nbsp; 4/29/2014&amp;nbsp; a10,axau10,a1010,axau1010
;
 
data B;
infile cards truncover &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;
informat date mmddyy10.&amp;nbsp;&amp;nbsp;&amp;nbsp; code $8.;
input date code;
format date mmddyy10.;
cards;
4/29/2014&amp;nbsp; a10
4/29/2014&amp;nbsp; a10
4/29/2014&amp;nbsp; a10
4/29/2014&amp;nbsp; x1010
4/29/2014&amp;nbsp; w10
;
proc sort data=b out=bb nodupkey;by date code;run;
proc sql;
create table temp as 
 select a.*,bb.code as new_code
&amp;nbsp; from a,bb
&amp;nbsp;&amp;nbsp; where a.date=bb.date and a.code contains strip(bb.code)
&amp;nbsp;&amp;nbsp;&amp;nbsp; order by id,date,code;
quit;
data want;
 set temp;
 by id date code;
 length _code $ 40;
 retain _code;
 _code=catx(',',_code,new_code);
 if last.code then do;output;call missing(_code);end;
 drop new_code;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 09:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sql-contains/m-p/139652#M261455</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-01T09:57:58Z</dc:date>
    </item>
  </channel>
</rss>

