title: How to keep the same amount of people based on a column in SAS Guide?
body: <p>Imagine this is what I have:</p>
  <pre><code>id  x   y    z     target
  1   a   b    c          1
  1   a   b    c          1
  1   a   b    c          1
  2   a   b    c          0
  2   a   b    c          0
  3   a   b    c          0
  4   a   b    c          0
  4   a   b    c          0
  5   a   b    c          1
  5   a   b    c          1 
  6   a   b    c          0
  6   a   b    c          0
  6   a   b    c          0
  7   a   b    c          0
  7   a   b    c          0
  </code></pre>
  <p>What I need is to keep the same amount of IDs (and its rows) based on the target variable, randomly, so I have a balanced dataset to create a predictive model.</p>
  <p>In this example we have 2 IDs with target 1 and 5 IDs with target 0, so it is a not balanced dataset based on the target variable. My original dataset is composed by 1142 IDs with target 1 and 8395 IDs with target 0.</p>
  <p>I want to keep the dataset as big as possible, so, to keep the same amount of IDs for each value of the target variable, the output would be, for example, 2 IDs with target 1 (which are in disadvantage) and 2 IDs with target 0.
  And I said randomly because there are no further rules to filter who with target 1 is being kept.</p>
  <p>I have been searching but can't seem to find anything similar. Thank you for the help.</p>