<?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: Merging Compustat and Crsp by trading days in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Compustat-and-Crsp-by-trading-days/m-p/573735#M162026</link>
    <description>&lt;P&gt;No. there is nothing wrong in my code. This is good to use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no delete button to remove my post so... a happening &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; or &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be sure to put (trading day - calendar day) so that the figure is positive (&amp;gt;=0)&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2019 03:27:30 GMT</pubDate>
    <dc:creator>JKCho</dc:creator>
    <dc:date>2019-07-16T03:27:30Z</dc:date>
    <item>
      <title>Merging Compustat and Crsp by trading days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Compustat-and-Crsp-by-trading-days/m-p/573722#M162024</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. It is easy to merge the Compustat and the CRSP.&lt;/P&gt;&lt;P&gt;What if I want something different?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now have been trying to match these two in a more precise way.&lt;/P&gt;&lt;P&gt;For example, if a fiscal year-end of a firm in the Compustat is 2019/11/30(Saturday), I cannot match with the exact same date from the CRSP as the CRSP only contains trading days! (no holidays, no Saturdays, no Sundays!!!)&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to match this fiscal year-end with&amp;nbsp;the closed next trading day. In the case of the above example, it should be 2019/12/02(Monday).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To achieve this matching, I referred this link:&amp;nbsp;&lt;A href="https://wrds-www.wharton.upenn.edu/pages/support/applications/event-studies/event-study-research-application/" target="_blank"&gt;https://wrds-www.wharton.upenn.edu/pages/support/applications/event-studies/event-study-research-application/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically in Step3. and this code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; create table temp
 as select a.permno, b.*
  from input a left join caldates b
  on &lt;STRONG&gt;b.evtdate-a.edate&amp;gt;=0&lt;/STRONG&gt;
  group by a.edate
  &lt;STRONG&gt;having (b.evtdate-a.edate)=min(b.evtdate-a.edate);&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The last row shows that it minimizes the days between trading day and fiscal year-end(calendar day).&amp;nbsp;&lt;/P&gt;&lt;P&gt;But... **bleep**:( That last code did not work and match quite weirdly...&lt;/P&gt;&lt;P&gt;This codes matched fiscal year-end of 2010/10/30 to 2009/03/31 (WHAT???) and many like this.&lt;/P&gt;&lt;P&gt;So far... my conclusion is having(~~~~) code does not work and need another.&lt;/P&gt;&lt;P&gt;I have tried revising on b.~~~ part as well but could not get meaningful one. Since I set fiscal year-ends to be ahead of trading days, the code looks logical(yes. it should be trading-fiscal &amp;gt;= 0).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cannot guess what's wrong with my code... looks all fine but wired outcomes.&lt;/P&gt;&lt;P&gt;Please have a look and share your thoughts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 02:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Compustat-and-Crsp-by-trading-days/m-p/573722#M162024</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-16T02:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Compustat and Crsp by trading days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Compustat-and-Crsp-by-trading-days/m-p/573735#M162026</link>
      <description>&lt;P&gt;No. there is nothing wrong in my code. This is good to use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no delete button to remove my post so... a happening &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; or &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Be sure to put (trading day - calendar day) so that the figure is positive (&amp;gt;=0)&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 03:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Compustat-and-Crsp-by-trading-days/m-p/573735#M162026</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-16T03:27:30Z</dc:date>
    </item>
  </channel>
</rss>

