title: How to fill in missing values by group?
body: <p>I have the following data structure. Within each group, some observations have missing <code>value</code>. I do know that each group has only one non-missing value (<code>10</code> for group 1 and <code>11</code> for group 2 in this case). The location of the missing observations are random within the group (i.e. can't fill in missing values with the previous / following value). </p>
  
  <p>How to fill the missing values with the one non-missing value by group? </p>
  
  <pre><code>group  value
  1       .
  1       10
  1       .
  2       11
  2       .
  2       11
  </code></pre>
  
  <p>My current solution is a loop, but I suspect there's some clever <code>bysort</code> that I can use.</p>
  
  <pre><code>levelsof group, local(lm_group)
  foreach group in `lm_group' {
      levelsof value if group == `group', local(lm_value)
      replace value = `lm_value' if group == `group'
  }
  </code></pre>