title: Reformatting two-digit year in Stata from string to date-time using top-year
body: <p>I understand to translate the strings 01-12-06 AND 01-12-96 as dates in Stata, you must:</p>
  
  <ul>
  <li>specify the assumed prefix in the mask, "DM20Y" and </li>
  <li>add an optional argument topyear: clock(string, mask, topyear)</li>
  </ul>
  
  <p>So, <code>generate double timestamp = clock(timestr, "DMY", 2020)</code> makes the two-digit year 06 interpreted as 2006 because 2006 does not exceed 2020. The two-digit year 96 would be interpreted as 1996 because 2096 does exceed 2020.</p>
  
  <p>But, I'm having trouble implementing this. So, instead I decided to: </p>
  
  <pre><code>g date = date(strdate, "MD20Y")
  format date %td
  </code></pre>
  
  <p>Then I want to basically replace dates greater than 2040 with the prefix "19" (so 2097 becomes 1997; but 2006 stays 2006).</p>
  
  <p>Can somebody please tell me how to write that conditional statement? I keep getting errors.</p>
  
  <p>Or, conversely, how do I use the <code>topyear</code> functionality correctly?</p>