<?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: How to match using date identifier in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573425#M161892</link>
    <description>You can use the WEEKDAY interval to get closer by the way, that only counts weekdays.</description>
    <pubDate>Mon, 15 Jul 2019 04:04:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-15T04:04:43Z</dc:date>
    <item>
      <title>How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573338#M161851</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  select HAVE.FRIMID, COMP_T, CRSP_T, ASSET, RETURN 
  from HAVE, CRSP
  where HAVE.date =CRSP.(date+1year or +1month) and HAVE.ID =CRSP.ID
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code just represents what I want...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can see&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;HAVE.date =CRSP.(date+1year)&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;What I am doing now is to calculate annual return starting from a specific date. e.g. 2019/10/31~2020/10/31. To do this, I need to have prices now and a year later. However, I do not know how to match. Since it is not just a number but year... +1 does not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me how can I add day/month/year on my identifiers when they are calendar dates...&lt;/P&gt;&lt;P&gt;I first made code to transform that YYMMDD to YYMM and then +1. but it sometimes does not make sense as if the case is 2013/12 then +1 is 2013/13... or 2013/10/31 became 2013/10/32... instead 2013/11/01.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I need to match same to same+@ instead same to same, I am struggling with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me. I searched for other posts but haven't found similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 04:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573338#M161851</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-14T04:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573340#M161852</link>
      <description>&lt;P&gt;Use the intnx() function to calculate date intervals.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 05:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573340#M161852</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-14T05:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573402#M161879</link>
      <description>SAS considers dates as numbers so you can just add numbers to get what you want. The trick is accounting for months and years which are not consistent, and the ending of a year, as you've already noticed. &lt;BR /&gt;&lt;BR /&gt;So SAS has a function INTNX() that allows you increment dates instead. However, to use it you must have a SAS date, which is a numeric variable (variable type) with a date format applied.</description>
      <pubDate>Sun, 14 Jul 2019 20:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573402#M161879</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-14T20:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573420#M161887</link>
      <description>Thank you Reeza!!&lt;BR /&gt;I am pretty sure how intnx or intck.&lt;BR /&gt;Before doing my works, I just want to ask a quick question. INTNX() just increments dates, months, or years but does not check whether these incremented dates are trading days or not. If so, I need to add another code to match my data properly and more precisely by like this..&lt;BR /&gt;having (b.trading-a.non_trading)=min(b.trading-a.non_trading);</description>
      <pubDate>Mon, 15 Jul 2019 03:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573420#M161887</guid>
      <dc:creator>JKCho</dc:creator>
      <dc:date>2019-07-15T03:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573423#M161890</link>
      <description>If you need to deal with trading dates you need to create a custom calendar. You'll also need to consider if stocks are in other countries and follow other calendars.</description>
      <pubDate>Mon, 15 Jul 2019 03:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573423#M161890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T03:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to match using date identifier</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573425#M161892</link>
      <description>You can use the WEEKDAY interval to get closer by the way, that only counts weekdays.</description>
      <pubDate>Mon, 15 Jul 2019 04:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-match-using-date-identifier/m-p/573425#M161892</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-15T04:04:43Z</dc:date>
    </item>
  </channel>
</rss>

