title: Multiple conditions for same variable in SAS
body: <p>I'm trying to detect specific values of one variable and create a new one if those conditions are fulfilled. </p>
  
  <p>Here's a part of my data (I have much more rows) :</p>
  
  <pre><code>id time result 
  1  1    normal 
  1  2    normal 
  1  3    abnormal 
  2  1    normal 
  2  2    
  3  3    normal  
  4  1    normal 
  4  2    normal      
  4  3    abnormal  
  5  1    normal 
  5  2    normal   
  5  3             
  </code></pre>
  
  <p>What I want </p>
  
  <pre><code>id time result    base 
  1  1    normal 
  1  2    normal      x
  1  3    abnormal 
  2  1    normal      x
  2  2  
  2  3    normal  
  3  3    normal          
  4  1    normal 
  4  2    normal      x
  4  3    abnormal    
  5  1    normal 
  5  2    normal      x
  5  3               
  </code></pre>
  
  <p>My baseline value (base) should be populated when result exists at timepoint (time) 2. If there's no result then baseline should be at time=1.  </p>
  
  <pre><code>if result="" and time=2 then do; 
  if time=10 and result ne "" then base=X; end;
  
  if result ne "" and time=2 then base=X;  `   
  </code></pre>
  
  <p>It works correctly when time=2 and results exists. But if results missing, then there's something wrong. </p>