<?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: Issue with merging data in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213437#M16019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you get the desired results using a where clause in the second example?&amp;nbsp; Depending on where the data comes from you can do this:&lt;/P&gt;&lt;P&gt;dca_percent(in=b where=(PURCHASE_DATE &amp;gt;= CPA_START_DT AND PURCHASE_DATE &amp;lt;= CPA_EXP_DT));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Mar 2015 16:51:16 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2015-03-31T16:51:16Z</dc:date>
    <item>
      <title>Issue with merging data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213436#M16018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to merge 2 data sets. One has many rows with a date and the other has 3 rows and a data range with the aplicable value that i need to be picked up.&lt;/P&gt;&lt;P&gt;I need to show the correct value for each row in a by picking up the correct value within the date range specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the following -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql; &lt;/P&gt;&lt;P&gt;create table work.EDW_ALL as&lt;BR /&gt;select * &lt;BR /&gt;from EDW_PLUS_CPC a&lt;BR /&gt; left join DCA_PERCENT b&lt;BR /&gt; ON a.DEALER_CODE=b.dealer_code&lt;BR /&gt; and A.CPC=B.CPC &lt;BR /&gt; AND&amp;nbsp; A.DLR_IP=B.DLR_IP&lt;BR /&gt; and PURCHASE_DATE &amp;gt;= CPA_START_DT&lt;BR /&gt; AND PURCHASE_DATE &amp;lt;= CPA_EXP_DT&lt;BR /&gt; ;&lt;BR /&gt; QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me all the 225 rows I need but only gives me the merged value when the date falls into the first range on the b dataset,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.EDW_ALL;&lt;/P&gt;&lt;P&gt; merge&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EDW_PLUS_CPC (in=a)&lt;/P&gt;&lt;P&gt;&amp;nbsp; DCA_PERCENT (in=b);&lt;/P&gt;&lt;P&gt; by DEALER_CODE CPC DLR_IP;&lt;/P&gt;&lt;P&gt;if (PURCHASE_DATE &amp;gt;= CPA_START_DT&lt;/P&gt;&lt;P&gt;AND PURCHASE_DATE &amp;lt;= CPA_EXP_DT);&lt;/P&gt;&lt;P&gt; if a then&lt;/P&gt;&lt;P&gt;&amp;nbsp; output work.EDW_ALL;&lt;/P&gt;&lt;P&gt;run&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This gives me just 10 rows where the date falls into the first range on the b dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would appear that the first row is being picked up rather than picking up the correct value for each date/row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any thoughts would be gratefully appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2015 14:47:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213436#M16018</guid>
      <dc:creator>ealderm2</dc:creator>
      <dc:date>2015-03-31T14:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with merging data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213437#M16019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you get the desired results using a where clause in the second example?&amp;nbsp; Depending on where the data comes from you can do this:&lt;/P&gt;&lt;P&gt;dca_percent(in=b where=(PURCHASE_DATE &amp;gt;= CPA_START_DT AND PURCHASE_DATE &amp;lt;= CPA_EXP_DT));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2015 16:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213437#M16019</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-03-31T16:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with merging data</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213438#M16020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you post some sample data? Is the "Applicable Value" variable the same or different in the two data sets?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Mar 2015 17:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Issue-with-merging-data/m-p/213438#M16020</guid>
      <dc:creator>JayCorbett</dc:creator>
      <dc:date>2015-03-31T17:03:14Z</dc:date>
    </item>
  </channel>
</rss>

