title: how to define the lastest time of publication for a time series
body: <p>I have a hundred time series.</p>
  
  <p>These time series are among a hundred of thousand of other time series published by a major european institution, either at the end of each quarter or at the end of each month. </p>
  
  <p>The institution does not publish the release date for the time series because it is too cumbersome. They publish, however, the timeliness for each series.</p>
  
  <p>To have the estimate release date for the time series, you need to have the end of the quarters or the end of the months and you add a certain numbers of days to it.</p>
  
  <p>An example would be </p>
  
  <pre><code>Serie A: Q1 2014 = end of January(31/01/2014) plus 50 days (x represents the number of days) = 22/03/2014
  Serie B: M4 2014 = end of April (30/04/2014) plus 40 days = 09/06/2014
  Serie C: M2 2014 = end of February (28/02/2014) plus 57 days = 26/04/2014
  Serie D: Q4 2013 = end of December (31/12/2013) plus 25 days = 25/01/2014
  </code></pre>
  
  <p>I've created a dictionary like that is called dico</p>
  
  <pre><code>     serie_name latest_release_time available
       serie A    22/03/2014          . 
       serie B    09/06/2014          .
       serie C    26/04/2014          . 
       serie D    25/01/2014          .
  </code></pre>
  
  <p>Let's say that the today's date is 08/07/2014. </p>
  
  <p>My aim would be to select the latest series. In this example, it would be Serie B as it is the closest to the 08/07/2014 </p>
  
  <p>I don't think there is a function in SAS or SQL that allows you to check the nearest date except if you say do something like that</p>
  
  <pre><code>proc sql;
  update dico set available="yes" where intnx('month',release_date,1) &gt; date();
  quit;
  </code></pre>
  
  <p>Am I correct?</p>
  
  <p>Cheers for the help.</p>