title: Retaining a value for all observations in SAS
body: <p>I have a data set that looks like the following but with multiple patients:</p>
  
  <pre><code>ID   Variable   val    Visit  
  A     Height     5     Base
  A     Weight     3     Base
  A     BMI        1     Base
  A     Height     2    Visit 1
  A     Weight     4    Visit 1
  A     BMI        3    Visit 1
  
  data have;
  input id    var $   val visit $;
  cards;
  A height 5 base
  A weight 3 base
  A bmi 1 base
  A height 2 visit1
  A weight 4 visit1
  A bmi 3 visit1
  ;
  </code></pre>
  
  <p>I would like to create a 3 new columns that retains the base value for all visits: </p>
  
  <pre><code> ID   Variable  Value   Visit    Height   Weight   BMI 
   A     Height     5     Base       5        3      1    
   A     Weight     3     Base       5        3      1 
   A     BMI        1     Base       5        3      1 
   A     Height     2    Visit 1     5        3      1  
   A     Weight     4    Visit 1     5        3      1    
   A     BMI        3    Visit 1     5        3      1
  </code></pre>
  
  <p>I would attempt this by retaining the "base" value but I'm a bit stumped on how to approach it. </p>