title: SAS: How can you write an IF statement to categorize data before a certain date and after it
body: <p>I have a table with a column named DATE1 with format YYYY-MM-DD, and I need to create another column to categorize data into two groups. How should I write the code? I think that the problem is with the date format, the syntax should change.</p>
  
  <pre><code>    Data Tabla1;
      set &amp;tTable0; 
  
      if DATE1 &lt; 2001-12-31 THEN DATE1_AUX = "&lt;2001"; else
     DATE1_AUX = &gt;2001;
  
      keep    Date1
              DATE1_AUX;
  
      run;
  </code></pre>