title: SAS and Date operations
body: <p>I've tried googling and I haven't turned up any luck to my current problem. Perhaps someone can help?</p>
  
  <p>I have a dataset with the following variables:</p>
  
  <p><code>ID</code>, <code>AccidentDate</code></p>
  
  <p>It's in long format, and each participant can have more than 1 accident, with participants having not necessarily an equal number of accidents. Here is a sample:</p>
  
  <p>Code: </p>
  
  <pre><code>ID  AccidentDate
  1   1JAN2001
  2   4MAY2001
  2   16MAY2001
  3   15JUN2002
  3   19JUN2002
  3   05DEC2002
  4   04JAN2003
  </code></pre>
  
  <p>What I need to do is count the number of days between each individuals First and Last recorded accident date. I've been playing around with <code>first.byvariable</code> and <code>last.byvariable</code> commands, but I'm just not making any progress. Any tips? or Any links to a source?</p>
  
  <p>Thank you, </p>
  
  <p>Also. I posted this originally over at Talkstats.com (cross-posting etiquette)</p>