<?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 Proc SQL merging problem possibly coding issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767864#M243489</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge two datasets but I seem to be missing something as the data I merge does not look really good. I try to add new variable to existing dataset on the condition that two variables have the same values in two different datasets. I attach partially both datasets. You will see when you merge, all data merges to the same observations. Log is clear so this possibly a coding problem. I did not attach the full datasets but partial datasets for crspmonthly2 and mergedcikedgar. The final output file is attached. I see that a one observation is matched with all the appended variables. Can be it be related with empty date cell in the data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql; create table perm.mergedcikedgar10 as select&lt;BR /&gt;a.*, b.gvkey&lt;BR /&gt;from perm.Mergedcikedgar as a left join perm.crspmonthly2 as b&lt;BR /&gt;on a.Cik=b.CIK&lt;BR /&gt;and month(a.date) eq month(b.datadate)&lt;BR /&gt;and year(a.date) eq year(b.datadate);&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Sep 2021 10:51:52 GMT</pubDate>
    <dc:creator>OzanKirtac</dc:creator>
    <dc:date>2021-09-15T10:51:52Z</dc:date>
    <item>
      <title>Proc SQL merging problem possibly coding issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767864#M243489</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge two datasets but I seem to be missing something as the data I merge does not look really good. I try to add new variable to existing dataset on the condition that two variables have the same values in two different datasets. I attach partially both datasets. You will see when you merge, all data merges to the same observations. Log is clear so this possibly a coding problem. I did not attach the full datasets but partial datasets for crspmonthly2 and mergedcikedgar. The final output file is attached. I see that a one observation is matched with all the appended variables. Can be it be related with empty date cell in the data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql; create table perm.mergedcikedgar10 as select&lt;BR /&gt;a.*, b.gvkey&lt;BR /&gt;from perm.Mergedcikedgar as a left join perm.crspmonthly2 as b&lt;BR /&gt;on a.Cik=b.CIK&lt;BR /&gt;and month(a.date) eq month(b.datadate)&lt;BR /&gt;and year(a.date) eq year(b.datadate);&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 10:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767864#M243489</guid>
      <dc:creator>OzanKirtac</dc:creator>
      <dc:date>2021-09-15T10:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL merging problem possibly coding issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767868#M243493</link>
      <description>&lt;P&gt;Looks like there is only one match in your datasets that meets the conditions of the dates.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 11:06:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767868#M243493</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-15T11:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL merging problem possibly coding issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767935#M243519</link>
      <description>&lt;P&gt;Equality for comparisons is very restrictive. So you may need to make sure the values are as you expect in multiple data sets.&amp;nbsp; "ABC" does not match "Abc" or " ABC" (note leading space). You may need to make your comparison for character values case insensitive, such as UPCASE or LOWCASE both values, or make sure that there are no leading spaces or different numbers of embedded spaces ("A BC" is not equal to "A&amp;nbsp;&amp;nbsp; BC"), or that other characters separating values such as comma or hyphens are exactly the same in both sets. Also some times depending on your data source characters that look the same such as dash may be a different dash character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 16:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-merging-problem-possibly-coding-issue/m-p/767935#M243519</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-15T16:42:44Z</dc:date>
    </item>
  </channel>
</rss>

