<?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: Information : LIKE / CONTAINS on the fritz? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72407#M20985</link>
    <description>Sorry about that, misplaced that one while replacing the naming of the original query.&lt;BR /&gt;
&lt;BR /&gt;
As far as the trailing blanks are concerned, wouldn't be surprised if those were the cause of it once again. The "SAS fills character-types up with blanks"-thing rears it's ugly head every once in a while, just when you least expect it.&lt;BR /&gt;
&lt;BR /&gt;
I'll let you know as soon as possible if your suggestions did the trick. I expect so though.&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot, even if this wouldn't quite do the trick yet!</description>
    <pubDate>Tue, 22 Sep 2009 10:41:58 GMT</pubDate>
    <dc:creator>RFLinnenbank</dc:creator>
    <dc:date>2009-09-22T10:41:58Z</dc:date>
    <item>
      <title>LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72402#M20980</link>
      <description>I've got two tables, A and B.&lt;BR /&gt;
In table A there is a field filled with complete names.(A)&lt;BR /&gt;
In table B there is a field filled with partial names.(B)&lt;BR /&gt;
&lt;BR /&gt;
Both fields are in upper case (UPCASE).&lt;BR /&gt;
In the query I call for the entire fieldset (*) of Table A, where field (A) contains field (B). (It doesn't matter which one, so there isn't any JOIN)&lt;BR /&gt;
&lt;BR /&gt;
This yields no results in some of the cases where I can clearly see they should.&lt;BR /&gt;
When I make the same comparison using only the fields (A) and (B) as their respective tables, this does work however.&lt;BR /&gt;
&lt;BR /&gt;
Would anybody know the reason for this?</description>
      <pubDate>Mon, 21 Sep 2009 14:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72402#M20980</guid>
      <dc:creator>RFLinnenbank</dc:creator>
      <dc:date>2009-09-21T14:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72403#M20981</link>
      <description>It's important to share your code for good feedback.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 21 Sep 2009 14:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72403#M20981</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-21T14:06:44Z</dc:date>
    </item>
    <item>
      <title>Information : LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72404#M20982</link>
      <description>Here it is. Did have to replace the names though (confidentiality issue):&lt;BR /&gt;
&lt;B&gt;Table1.naam&lt;/B&gt;  = Partial Name belonging to an adress&lt;BR /&gt;
&lt;B&gt;Table2.naam&lt;/B&gt;  = Full name (originally can contain &lt;B&gt;'&lt;/B&gt; or &lt;B&gt;"&lt;/B&gt;, hence &lt;B&gt;COMPRESS&lt;/B&gt;)&lt;BR /&gt;
&lt;B&gt;&amp;amp;SOURCETABLE&lt;/B&gt; = reference to source table name. (working of course)&lt;BR /&gt;
&lt;BR /&gt;
*** The next 2 queries set up the 2 tables as wel as formats NAAM to upper case ***;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
	CREATE TABLE TUSSENDT.TABLE1 AS &lt;BR /&gt;
	SELECT 	SOURCE.GROEP,&lt;BR /&gt;
		UPCASE(SOURCE.NAAM) AS NAAM,&lt;BR /&gt;
		SOURCE.HUISNR,&lt;BR /&gt;
		SOURCE.POSTCODE&lt;BR /&gt;
	FROM &amp;amp;SOURCETABLE AS SOURCE&lt;BR /&gt;
	WHERE SOURCE.GROEP NOT IS NULL;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
	CREATE TABLE TUSSENDT.TABLE2 AS &lt;BR /&gt;
	SELECT UPCASE(COMPRESS(COMPRESS(TABLE2SOURCE.NAAM,''''),'"')) AS NAAM FORMAT=$200.,&lt;BR /&gt;
		TABLE2SOURCE.ID AS ID FORMAT=11.,&lt;BR /&gt;
		TABLE2SOURCE.HUISNR AS HUISNR FORMAT=$6.,&lt;BR /&gt;
         	TABLE2SOURCE.HUISNRTOE AS HUISNRTOE FORMAT=$12.,&lt;BR /&gt;
         	TABLE2SOURCE.POSTCODE AS POSTCODE FORMAT=$6.,&lt;BR /&gt;
         	TABLE2SOURCE.BUITENLAND_IND AS BUITENLAND_IND FORMAT=$1.,&lt;BR /&gt;
         	TABLE2SOURCE.BEKEND_DAT AS BEKEND_DAT FORMAT=MMDDYY8.&lt;BR /&gt;
	FROM SOURCE.TABLE2SOURCE AS TABLE2SOURCE;&lt;BR /&gt;
QUIT;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** Checks if TABLE2.naam contains a TABLE1.naam, adds GROEP and NAAM from TABLE1 ***;&lt;BR /&gt;
&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
 CREATE TABLE WORK.KOI_INFO_OP_NAAM AS SELECT DISTINCT TABLE2.ID FORMAT=11.,&lt;BR /&gt;
	TABLE1.NAAM FORMAT=$200. AS NAAM_1,&lt;BR /&gt;
	TABLE2.NAAM FORMAT=$200. AS NAAM_2,&lt;BR /&gt;
        TABLE2.HUISNR FORMAT=$6.,&lt;BR /&gt;
        TABLE2.HUISNRTOE AS HUISN2 FORMAT=$12.,&lt;BR /&gt;
        TABLE2.POSTCODE AS POSTCO FORMAT=$6.,&lt;BR /&gt;
        TABLE2.BUITENLAND_IND AS BUITEN FORMAT=$1.,&lt;BR /&gt;
        TABLE2.BEKEND_DAT AS BEKEND FORMAT=MMDDYY8.,&lt;BR /&gt;
        TABLE1.GROEP,&lt;BR /&gt;
        ('OP NAAM') AS OORSPRONG&lt;BR /&gt;
 FROM TUSSENDT.TABLE2 AS TABLE2,&lt;BR /&gt;
        TUSSENDT.TABLE2 AS TABLE2&lt;BR /&gt;
 WHERE TABLE2.NAAM Contains TABLE1.NAAM;&lt;BR /&gt;
QUIT;

- As extra information: I'm using SAS 9.1.3&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: RFLinnenbank</description>
      <pubDate>Tue, 22 Sep 2009 08:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72404#M20982</guid>
      <dc:creator>RFLinnenbank</dc:creator>
      <dc:date>2009-09-22T08:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Information : LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72405#M20983</link>
      <description>I did a simplified example using SASHELP.CLASS:&lt;BR /&gt;
&lt;BR /&gt;
14         /* Infoga anpassad kod före skickad kod här */&lt;BR /&gt;
15         options msglevel=i;&lt;BR /&gt;
16         &lt;BR /&gt;
17         data ClassPartname;&lt;BR /&gt;
18         set sashelp.class;&lt;BR /&gt;
19         length PartName $2;&lt;BR /&gt;
20         PartName = substr(name,2,2);&lt;BR /&gt;
21         keep Partname;&lt;BR /&gt;
22         run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;
NOTE: The data set WORK.CLASSPARTNAME has 19 observations and 1 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
      &lt;BR /&gt;
&lt;BR /&gt;
23         &lt;BR /&gt;
24         proc sql;&lt;BR /&gt;
25         create table ContainsJoin as&lt;BR /&gt;
26         select class.*, PartName&lt;BR /&gt;
27         from sashelp.class as class,&lt;BR /&gt;
28         ClassPartName&lt;BR /&gt;
29         where class.Name contains ClassPartName.PartName&lt;BR /&gt;
30         ;&lt;BR /&gt;
NOTE: The execution of this query involves performing one or more Cartesian product joins that can not be optimized.&lt;BR /&gt;
NOTE: Table WORK.CONTAINSJOIN created, with 31 rows and 6 columns.&lt;BR /&gt;
&lt;BR /&gt;
31         quit;&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.01 seconds&lt;BR /&gt;
To help you out more, please share the input data to the "join", and any LOG information that could be of interest.&lt;BR /&gt;
&lt;BR /&gt;
/Linus

Message was edited by: Linus H</description>
      <pubDate>Tue, 22 Sep 2009 10:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72405#M20983</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-09-22T10:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Information : LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72406#M20984</link>
      <description>You can leave off the FORMAT=  keyword for character variables.  Also, you must have an incorrect FROM in your last PROC SQL query (there is no TABLE1 reference).  I suspect that you need a change to CONTAINS TRIM(TABLE1.NAAM), adding the TRIM function, otherwise (at least with a DATA step), the padded variable length (LENGTH, not FORMAT) is used which could result in no-match if there is trailing blanks.&lt;BR /&gt;
&lt;BR /&gt;
And, so, you will need to dump your TABLE1 values for NAAM to attempt to correlate them against a "compressed" TABLE2.NAAM.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 22 Sep 2009 10:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72406#M20984</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-22T10:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Information : LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72407#M20985</link>
      <description>Sorry about that, misplaced that one while replacing the naming of the original query.&lt;BR /&gt;
&lt;BR /&gt;
As far as the trailing blanks are concerned, wouldn't be surprised if those were the cause of it once again. The "SAS fills character-types up with blanks"-thing rears it's ugly head every once in a while, just when you least expect it.&lt;BR /&gt;
&lt;BR /&gt;
I'll let you know as soon as possible if your suggestions did the trick. I expect so though.&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot, even if this wouldn't quite do the trick yet!</description>
      <pubDate>Tue, 22 Sep 2009 10:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72407#M20985</guid>
      <dc:creator>RFLinnenbank</dc:creator>
      <dc:date>2009-09-22T10:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Information : LIKE / CONTAINS on the fritz?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72408#M20986</link>
      <description>Turns out it was indeed once again a Trimming issue!&lt;BR /&gt;
Works like a charm now!</description>
      <pubDate>Mon, 28 Sep 2009 11:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/LIKE-CONTAINS-on-the-fritz/m-p/72408#M20986</guid>
      <dc:creator>RFLinnenbank</dc:creator>
      <dc:date>2009-09-28T11:21:27Z</dc:date>
    </item>
  </channel>
</rss>

