<?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: Problem with merging 2 datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129909#M26513</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just as information, and to keep your datastep example, you migt use the following code (which makes the same as the PROC SQL provided by DBailey). As long as the observations exist in the dataset1, they will appear in the merged dataset (with empty values in the fields normally coming from the dataset2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data merged;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge dataset1 (in = inDS1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset2 (in = inDS2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by MutualfundID year month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if inDS1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Mar 2013 17:11:49 GMT</pubDate>
    <dc:creator>Florent</dc:creator>
    <dc:date>2013-03-07T17:11:49Z</dc:date>
    <item>
      <title>Problem with merging 2 datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129906#M26510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 2 datasets:&lt;/P&gt;&lt;P&gt;1. contains approximately 25 million observations of 5 variables: MutualfundID, year, month, assetID and holdings. Each month of each year in my dataset it shows what the holdings of these funds in multiple assets are. So this contains several observations fora specfic mutualfund in a specific month; because the have positions in several assets.&lt;/P&gt;&lt;P&gt;2. contains 250.000 observations of 4 variables. Also: MutualfundID, year, month and then one other var: netfundflows. So this contains only 1 observation for a specific fund in a specific month because in shows net flows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to accomplish is that those fundflows come in as a 6th variable in the first dataset. Because each fund has multiple assets each month, the net fund flows will be repeated several times in that month because it relates to the fund itself and not to the&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; asset.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data merged;&lt;/P&gt;&lt;P&gt;merge dataset1 dataset2;&lt;/P&gt;&lt;P&gt;by MutualfundID, year, month;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this doesnt give me the right results. How should I approach this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 15:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129906#M26510</guid>
      <dc:creator>DaanUtrecht</dc:creator>
      <dc:date>2013-03-07T15:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with merging 2 datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129907#M26511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table merged as&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t1.*,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; t2.netfundflows&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset1 t1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; left outer join dataset2 t2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on t1.mutufalfundid=t2.mutualfundid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and t1.year=t2.year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and t1.month=t2.month;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 16:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129907#M26511</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-03-07T16:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with merging 2 datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129908#M26512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks DBailey, will try it asap!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 16:38:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129908#M26512</guid>
      <dc:creator>DaanUtrecht</dc:creator>
      <dc:date>2013-03-07T16:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with merging 2 datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129909#M26513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just as information, and to keep your datastep example, you migt use the following code (which makes the same as the PROC SQL provided by DBailey). As long as the observations exist in the dataset1, they will appear in the merged dataset (with empty values in the fields normally coming from the dataset2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data merged;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; merge dataset1 (in = inDS1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataset2 (in = inDS2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by MutualfundID year month;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if inDS1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 17:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-merging-2-datasets/m-p/129909#M26513</guid>
      <dc:creator>Florent</dc:creator>
      <dc:date>2013-03-07T17:11:49Z</dc:date>
    </item>
  </channel>
</rss>

