<?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: Failure to merge two data sets by date - month to quarterly data frequency conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778892#M247998</link>
    <description>&lt;P&gt;&lt;EM&gt;&amp;gt;This was my first post and I'll make sure to post in code in the future.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No worries, all good. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wish there were better explanations and requirements on the post page.&lt;/P&gt;
&lt;P&gt;The grey box on the right is much too incomplete, too easily ignored, and posters keep being reminded by repliers about how they should post so they can be helped.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2021 23:37:11 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-11-05T23:37:11Z</dc:date>
    <item>
      <title>Failure to merge two data sets by date - month to quarterly data frequency conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778559#M247834</link>
      <description>&lt;P&gt;I want to combine two data sets by a common date variable. The first data set was produced using proc expand to convert monthly data to quarterly frequency. The second data set has quarterly data and dates. I cannot merge the two files by date because they don't match up in the two files - while the second data set has informat and format of YYQ6. for the date, the first data set has informat of MMDDYY10. and format of YYQC6. for the date. I gather that the specific day of the quarterly data varies by day within a given quarter in the second data set. I've tried reformatting the date to quarter in the first data set without success. I'd appreciate your thoughts on how to merge the two files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4 (TS1M6) on an X64_10PRO platform. Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 17:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778559#M247834</guid>
      <dc:creator>Rcoder</dc:creator>
      <dc:date>2021-11-04T17:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Failure to merge two data sets by date - month to quarterly data frequency conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778566#M247841</link>
      <description>&lt;P&gt;Why post your code as a PDF? In the future please post it directly into your post using a code block.&lt;BR /&gt;&lt;BR /&gt;SAS formats control the appearance but in the MERGE it's using the underlying variable unless you specify the GROUPFORMAT option. Try adding that to your BY statement and then see if it works.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data stocks_A;
set sashelp.stocks;
where stock='IBM';
format date yymmn6.;
*keep only relevant variables for testing;
keep date open;

*rename to identify source;
rename open=OpenA;
run;

data stocks_B;
set sashelp.stocks;
where stock='IBM';
*dates are not the same now in each data set;
DATE = DATE + 1;
format date yymmn6.;

*keep only relevant variables for testing;
keep date open;

*rename to identify source;
rename open=OpenB;
run;

proc sort data=stocks_A; by date;
proc sort data=stocks_B; by date;
run;

*with group format;
data merged;
merge stocks_A stocks_B;
by date groupformat;
format date yymmn6.;
run;

*without group format;
data merged_WRONG;
merge stocks_A stocks_B;
by date;
format date yymmn6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Nov 2021 16:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778566#M247841</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-05T16:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Failure to merge two data sets by date - month to quarterly data frequency conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778598#M247857</link>
      <description>&lt;P&gt;1. The&amp;nbsp; PDF file is out of bounds, post your code as code (there's an icon for that).&lt;/P&gt;
&lt;P&gt;2. The merge happens on the value, the format has no influence.&lt;/P&gt;
&lt;P&gt;3. If the values are indeed different for a given quarter, it's better better to align them say on the first day of the quarter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Otherwise try SQL merging with &lt;FONT face="courier new,courier"&gt;put(DATE1,yyq.)=put(DATE2,yyq.)&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 21:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778598#M247857</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-05T21:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Failure to merge two data sets by date - month to quarterly data frequency conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778823#M247962</link>
      <description>&lt;P&gt;Thanks for your observations. This was my first post and I'll make sure to post in code in the future. The put statements in SQL worked perfectly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 16:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778823#M247962</guid>
      <dc:creator>Rcoder</dc:creator>
      <dc:date>2021-11-05T16:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Failure to merge two data sets by date - month to quarterly data frequency conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778892#M247998</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;This was my first post and I'll make sure to post in code in the future.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No worries, all good. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wish there were better explanations and requirements on the post page.&lt;/P&gt;
&lt;P&gt;The grey box on the right is much too incomplete, too easily ignored, and posters keep being reminded by repliers about how they should post so they can be helped.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2021 23:37:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Failure-to-merge-two-data-sets-by-date-month-to-quarterly-data/m-p/778892#M247998</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-11-05T23:37:11Z</dc:date>
    </item>
  </channel>
</rss>

