title: create a macro variable based on a condition SAS
body: <p>I have the following table</p>
  
  <pre><code>data have;
      input x1;
      datalines;
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      ;
  run;
  </code></pre>
  
  <p>and I'm trying to create a macro variable which allocates the number of distinct entries up to a maximum of ten so I can automatically create the right number of bins for a histogram later (max 10 bins)</p>
  
  <p>the code i'm currently trying to leverage is as follows but I'm unsure how to allocate the macro variable when there are more than 10 distinct observations</p>
  
  <pre><code>PROC SQL NOPRINT;
      SELECT COUNT(DISTINCT X1)
          INTO: BIN_X1
          FROM HAVE
          HAVING (COUNT(DISTINCT X1) LE 10);
  QUIT;
  </code></pre>
  
  <p>How do I allocate the macro variable to be 10 if there are more than 10 distinct obs?</p>