<?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: Merging Mystery: SAS won't match two numeric keys, but SPSS will in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320284#M70511</link>
    <description>&lt;P&gt;When you work with data the size that I do, character storage requirements are a massive cost. That is why numerics are a great ID variable.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2016 15:43:56 GMT</pubDate>
    <dc:creator>JLcra</dc:creator>
    <dc:date>2016-12-20T15:43:56Z</dc:date>
    <item>
      <title>Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320245#M70494</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a base SAS 9.4&amp;nbsp;merge conundrum that is mystifying me. I have two datasets that connect on an 8-digit ID unique to each person in my data. My merge is one to many. When I try to merge these files by ID, SAS fails to find any matches and appends the two files. Both files are sorted on ID only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data step, which has successfully merged different files that use the same key and come from the same source and were created using the same proc SQL code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.temp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; dataA(in=master) dataB(in=using);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; clt_id;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;masteronly=master and not using;&lt;/P&gt;&lt;P&gt;usingonly=using and not master;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;match=master=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; and using=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have checked both datasets, and the ID is a numeric of length 8 and format 11. in both files. I have visually inspected both files to doublecheck that at least one ID exists in both.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And, to make it more baffling, SPSS is able to correctly match the exact same files on the ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only potential answer I could find online is decimal instability, but my IDs are 8 digit integers and as far as I can tell SAS is only storing them as such because the type is only length 8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what could conceivably be causing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summary: Two files linked on 8-digit integer ID, one to many merge, same storage type for ID in both files, successfully merged using same code by same ID&amp;nbsp;with other files, visually confirmed at least one match exists, and SPSS matches files successfully.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 14:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320245#M70494</guid>
      <dc:creator>JLcra</dc:creator>
      <dc:date>2016-12-20T14:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320257#M70497</link>
      <description>&lt;P&gt;You are using &lt;STRONG&gt;set&lt;/STRONG&gt; statement, which will append the data,&lt;/P&gt;&lt;P&gt;You have to use &lt;STRONG&gt;merge &lt;/STRONG&gt;statement to merge the data in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.temp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;merge&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;dataA(in=master) dataB(in=using);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; clt_id;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;For more example please refer this link:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/modules/merge.htm" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/modules/merge.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 14:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320257#M70497</guid>
      <dc:creator>Kalind_Patel</dc:creator>
      <dc:date>2016-12-20T14:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320259#M70499</link>
      <description>&lt;P&gt;IDs should be character not numeric variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not matching can be due to numerical precision, bit as doubt it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think this is correct, I would suggest starting with only the MERGE and By and adding your conditions one by one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;masteronly=master and not using;&lt;BR /&gt;usingonly=using and not master;&lt;BR /&gt;match=master=1 and using=1;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 15:03:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320259#M70499</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-20T15:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320268#M70503</link>
      <description>&lt;P&gt;Ugh, thank you.&amp;nbsp;I knew I had to be making some stupid mistake.&amp;nbsp;Of course my brain kept reading right over the set when I double checked code. Just needed another pair of eyes to see it for me.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 15:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320268#M70503</guid>
      <dc:creator>JLcra</dc:creator>
      <dc:date>2016-12-20T15:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320271#M70506</link>
      <description>&lt;P&gt;No, IDs can and often are numerics. And those statements weren't conditions, just creating diagnostic variables to easily show me where records come from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution was a blatant dumb typo on my part, I wrote set instead of merge. The rest of the code is fine.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 15:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320271#M70506</guid>
      <dc:creator>JLcra</dc:creator>
      <dc:date>2016-12-20T15:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320278#M70509</link>
      <description>&lt;P&gt;Yes many people use numerics for Ids. Then get bitten by additions to the system where leading zeroes become significant. Or have to merge with another system that has character values. Or a new scheme comes in adding additional information to the id so the length exceeds 16 or 17 digits and starts causing problems with precision.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IMNSHO, if you aren't going to do arithmetic on a variable it only looks like a numeric value and should be character.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 15:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320278#M70509</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-20T15:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Mystery: SAS won't match two numeric keys, but SPSS will</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320284#M70511</link>
      <description>&lt;P&gt;When you work with data the size that I do, character storage requirements are a massive cost. That is why numerics are a great ID variable.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2016 15:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Mystery-SAS-won-t-match-two-numeric-keys-but-SPSS-will/m-p/320284#M70511</guid>
      <dc:creator>JLcra</dc:creator>
      <dc:date>2016-12-20T15:43:56Z</dc:date>
    </item>
  </channel>
</rss>

