<?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: SAS append/merge datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578364#M164023</link>
    <description>&lt;P&gt;It appears that you are taking ALL the observations from your first data set, followed by ALL the observations from the second data set.&amp;nbsp; If that's the case, you don't need a WHERE statement&amp;nbsp; A simple DATA step would be sufficient:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data datasets_2018_2019;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set ar_dataset_2018 ar_dataset_2019;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that using a WHERE statement assumes that the MONTH variable is actually a SAS date representing a particular day, and not just a month and year without a day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility ... this would run faster but would use the name AR_DATASET_2018 to hold the combined version of the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append data=ar_dataset_2019 base=ar_dataset_2018;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case of such small data sets, it seems like speeding up the program is not valuable, however.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2019 12:25:58 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-08-01T12:25:58Z</dc:date>
    <item>
      <title>SAS append/merge datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578309#M163993</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two datasets - &lt;FONT color="#FF0000"&gt;ar.dataset_2018&lt;/FONT&gt; and &lt;FONT color="#FF0000"&gt;ar.dataset_2019&lt;/FONT&gt;. Please can someone finish off the code below (highlighted in red/whether set is the correct method) that would combine the two datasets (screenshot below shows an extract of the individual 2018 and 2019 datasets and the third table is an example of what I would like the merged dataset to look like), with the new dataset only containing records between 1st January 2018 and 31st May 2019 (which I have included in the code I have written so far -&amp;nbsp;where '01Jan2018'd &amp;lt;= month &amp;lt;= '31May2019'd; )? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Code&lt;/U&gt;&lt;/P&gt;&lt;P&gt;data datasets_2018_2019;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;FONT color="#FF0000"&gt;set ar.dataset_2018 ar.dataset_2019;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /*What code to use to merge the two datasets, as shown by the screenshot?*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;where '01Jan2018'd &amp;lt;= month &amp;lt;= '31May2019'd;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Append.JPG" style="width: 522px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31454i86C8E273EA3C5940/image-size/large?v=v2&amp;amp;px=999" role="button" title="Append.JPG" alt="Append.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 09:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578309#M163993</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-08-01T09:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS append/merge datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578321#M163997</link>
      <description>&lt;P&gt;Not Tested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;set ar.dataset_2018 ar.dataset_2019;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;BY MONTH ID;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 10:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578321#M163997</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-08-01T10:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS append/merge datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578322#M163998</link>
      <description>Thanks for your reply. Would the code be:&lt;BR /&gt;&lt;BR /&gt;data datasets_2018_2019;&lt;BR /&gt;set ar.dataset_2018 ar.dataset_2019;&lt;BR /&gt;by month ID;&lt;BR /&gt;where '01Jan2018'd &amp;lt;= month &amp;lt;= '31May2019'd;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 01 Aug 2019 10:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578322#M163998</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-08-01T10:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS append/merge datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578323#M163999</link>
      <description>YES</description>
      <pubDate>Thu, 01 Aug 2019 10:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578323#M163999</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-08-01T10:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS append/merge datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578364#M164023</link>
      <description>&lt;P&gt;It appears that you are taking ALL the observations from your first data set, followed by ALL the observations from the second data set.&amp;nbsp; If that's the case, you don't need a WHERE statement&amp;nbsp; A simple DATA step would be sufficient:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data datasets_2018_2019;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set ar_dataset_2018 ar_dataset_2019;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that using a WHERE statement assumes that the MONTH variable is actually a SAS date representing a particular day, and not just a month and year without a day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another possibility ... this would run faster but would use the name AR_DATASET_2018 to hold the combined version of the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append data=ar_dataset_2019 base=ar_dataset_2018;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the case of such small data sets, it seems like speeding up the program is not valuable, however.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 12:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-append-merge-datasets/m-p/578364#M164023</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-08-01T12:25:58Z</dc:date>
    </item>
  </channel>
</rss>

