<?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: merge using month and year ? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215793#M14156</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help to provide example code of what you have attempted and a few records from each data set that demonstrate your difficultly.&lt;/P&gt;&lt;P&gt;Any time you use a data step MERGE with a BY statement all data sets must be sorted by those variables.&lt;/P&gt;&lt;P&gt;You probably need to do something like this before the merge:&lt;/P&gt;&lt;P&gt;Proc sort data=dataset1; by year month;run;&lt;/P&gt;&lt;P&gt;Proc sort data=dataset2; by year month;run;&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; merge dataset1 dataset2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by year month;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Apr 2015 18:29:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-04-03T18:29:15Z</dc:date>
    <item>
      <title>merge using month and year ?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215791#M14154</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;I have month and year variable which i extracted from date variable,&amp;nbsp; now i need o merge to other dataset which has date, but i want to merger only by their months and year not on their exact date?&lt;/P&gt;&lt;P&gt;how can i do that? If i try to extract year and month and try to merge by year and month, some times the results are correct, for example if it is one year worth data then i have no issue, when the dates are between two years then the problem comes, it throws me error that month variable is not properly sorted? Anyone Please help me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 16:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215791#M14154</guid>
      <dc:creator>pkmkart</dc:creator>
      <dc:date>2015-04-03T16:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: merge using month and year ?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215792#M14155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Create a date variable using MDY() function. i.e. new_date_var=mdy(month_var, 1, year_var)&lt;/P&gt;&lt;P&gt;2. Use a SQL join where you use a PUT() on the join condition i.e.&amp;nbsp; put(new_date_var, monyy7.)=put(other_date, monyy7.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 17:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215792#M14155</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-03T17:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: merge using month and year ?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215793#M14156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help to provide example code of what you have attempted and a few records from each data set that demonstrate your difficultly.&lt;/P&gt;&lt;P&gt;Any time you use a data step MERGE with a BY statement all data sets must be sorted by those variables.&lt;/P&gt;&lt;P&gt;You probably need to do something like this before the merge:&lt;/P&gt;&lt;P&gt;Proc sort data=dataset1; by year month;run;&lt;/P&gt;&lt;P&gt;Proc sort data=dataset2; by year month;run;&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; merge dataset1 dataset2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by year month;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Apr 2015 18:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215793#M14156</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-03T18:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: merge using month and year ?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215794#M14157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use a special option of BY.&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; merge dataset1 dataset2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by date &lt;STRONG&gt;groupformat&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format date monyy7.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Apr 2015 08:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/merge-using-month-and-year/m-p/215794#M14157</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-04T08:36:31Z</dc:date>
    </item>
  </channel>
</rss>

