title: How can I convert a numeric field YYYYMM to a date field so that I can subtract 90 days and then format the new field YYMMN6. in sas?
body: <p>I have a date field that is numeric and displays as 201603 (CalendarYearMonth), for example.  I want to be able to subtract 90 days from this date so that the end date is 201512 (RetentionYearMonth).  I then need to reference the end date from another table.  When I try to join the tables based on this date, they don't match because 201512 is showing as 20424 in the original table and 20423 in the table I am trying to join.  Any idea why I would be getting two different values for 201512?</p>
  
  <p>I tried the following:</p>
  
  <pre><code>DATA Quote2;
  SET Quote;
  YearMonth = INPUT(STRIP(PUT(CalendarYearMonth,6.))||'01',YYMMDD10.);
  RetentionYearMonth = YearMonth - 90;
  FORMAT RetentionYearMonth YYMMN6.;
  RUN;
  </code></pre>