<?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 SAS DATES SELECTION in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72717#M21079</link>
    <description>Hi guys, who can help me to figure out the following problem. &lt;BR /&gt;
&lt;BR /&gt;
I wanna calculate 1 calendar year return for 2700 firms. So the date to be selected from time series for each firm is like &lt;BR /&gt;
&lt;BR /&gt;
19900101&lt;BR /&gt;
19900102&lt;BR /&gt;
19900104&lt;BR /&gt;
   .......&lt;BR /&gt;
&lt;BR /&gt;
19910101&lt;BR /&gt;
19910102&lt;BR /&gt;
19910103&lt;BR /&gt;
&lt;BR /&gt;
if my event date is 19910103, and one year return is ln(19910103)-ln(19900103), however it might be 19910103 is a holiday, not traded. So I want to select 19900104 instead.  How can I do it in a generalized way that can perform 2700 simultaneously if same problem occurs to other firms. &lt;BR /&gt;
&lt;BR /&gt;
Thank you very much first.

Message was edited by: Fred_Gavin</description>
    <pubDate>Tue, 22 Sep 2009 21:01:56 GMT</pubDate>
    <dc:creator>Fred_Gavin</dc:creator>
    <dc:date>2009-09-22T21:01:56Z</dc:date>
    <item>
      <title>SAS DATES SELECTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72717#M21079</link>
      <description>Hi guys, who can help me to figure out the following problem. &lt;BR /&gt;
&lt;BR /&gt;
I wanna calculate 1 calendar year return for 2700 firms. So the date to be selected from time series for each firm is like &lt;BR /&gt;
&lt;BR /&gt;
19900101&lt;BR /&gt;
19900102&lt;BR /&gt;
19900104&lt;BR /&gt;
   .......&lt;BR /&gt;
&lt;BR /&gt;
19910101&lt;BR /&gt;
19910102&lt;BR /&gt;
19910103&lt;BR /&gt;
&lt;BR /&gt;
if my event date is 19910103, and one year return is ln(19910103)-ln(19900103), however it might be 19910103 is a holiday, not traded. So I want to select 19900104 instead.  How can I do it in a generalized way that can perform 2700 simultaneously if same problem occurs to other firms. &lt;BR /&gt;
&lt;BR /&gt;
Thank you very much first.

Message was edited by: Fred_Gavin</description>
      <pubDate>Tue, 22 Sep 2009 21:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72717#M21079</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-09-22T21:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES SELECTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72718#M21080</link>
      <description>You will want to look at using SAS date-related functions such as INTNX, HOLIDAY (moved to Base SAS with SAS 9.2), INTCK, MDY, and possibly others in order to adjust your SAS DATE (numeric) variable - you weren't actually clear that you have SAS numeric variables which represent your date values (though you demonstrated a "formatted" value yyyymmdd).&lt;BR /&gt;
&lt;BR /&gt;
The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted documentation and supplemental technical / conference topic-related reference material on this type of discussion. &lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Date Intervals, Formats, and Functions &lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/intervals_toc.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/intervals_toc.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: HOLIDAY Function&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003060817.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003060817.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
WORKING WITH SAS® DATE AND TIME FUNCTIONS&lt;BR /&gt;
Andrew H. Karp&lt;BR /&gt;
Sierra Information Services, Inc., San Francisco, California USA&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi23/Begtutor/p57.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi23/Begtutor/p57.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
TS-668 - SAS Dates, Times, and Interval Functions&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/technote/ts668.pdf" target="_blank"&gt;http://support.sas.com/techsup/technote/ts668.pdf&lt;/A&gt;</description>
      <pubDate>Tue, 22 Sep 2009 21:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72718#M21080</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-22T21:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES SELECTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72719#M21081</link>
      <description>Thanks for the suggestion. But the only function manual seems not that helpful.&lt;BR /&gt;
 &lt;BR /&gt;
As the data not balanced, with 2700 firms, I have to consider the same day on the last calender year is holiday or not, and SAS functions  only calculate the balanced days between two dates (say, number of week days between two days), but  there are public holidays or local holidays involved. On those days, stock market is not traded.&lt;BR /&gt;
&lt;BR /&gt;
Therefore I can define the day "today" ie. my event date, and if the last calendar date does exist, then I can define or extract as well. But I dont know how to extract if the last calendar date does not exist, but use next available date instead. (See my first post). &lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 23 Sep 2009 01:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72719#M21081</guid>
      <dc:creator>Fred_Gavin</dc:creator>
      <dc:date>2009-09-23T01:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DATES SELECTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72720#M21082</link>
      <description>It's important that you clearly understand how SAS DATE variables are counted.  A value of zero (numeric) is 01-Jan-1960 and 02-Jan-1960 is a value of 1.  Therefore you can increment / decrement your "event" date simply by applying +1 or -1, if needed.  Also there are other functions INTNX if the date calculation is more complex.  It's time to invest reading about SAS date variables from the DOC links provided.&lt;BR /&gt;
&lt;BR /&gt;
Also....as I do with dates and holidays:&lt;BR /&gt;
&lt;BR /&gt;
You can introduce your own holiday dates expressed either as a ddmmm (a formatted value) or a specify date (literal constant) - here is a small code sample:&lt;BR /&gt;
&lt;BR /&gt;
* Test for holidays always on the same date of the year. ;&lt;BR /&gt;
IF PUT(&lt;YOUR_EVENT_DATE&gt;,date5.) in ('23JAN','14APR','22MAY') THEN HOLIDAY = 1;&lt;BR /&gt;
* Test for holidays always on a specific date for a given year. ;&lt;BR /&gt;
  ELSE IF &lt;YOUR_EVENT_DATE&gt; in ('ddmmmyyyy'D,'ddmmmyyyy'D,'ddmmmyyyy'D) THEN&lt;BR /&gt;
    HOLIDAY = 1;&lt;BR /&gt;
ELSE DO;&lt;BR /&gt;
  * your additional logic. ;&lt;BR /&gt;
END;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/YOUR_EVENT_DATE&gt;&lt;/YOUR_EVENT_DATE&gt;</description>
      <pubDate>Wed, 23 Sep 2009 12:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-DATES-SELECTION/m-p/72720#M21082</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-23T12:08:21Z</dc:date>
    </item>
  </channel>
</rss>

