title: SAS Loop through Columns
body: <p>I am trying to write code in SAS which loops through the columns.</p>
  
  <p>DesiredVariable is what I am trying to calculate using a Loop</p>
  
  <p>where if the LengthValue for a Row is 5 Then the DesiredVariable value = Length5
  and if the LengthValue for a Row is 3 Then the DesiredVariable value = Length3</p>
  
  <p>(Image attached)</p>
  
  <p>I would really appreciate any help writing this loop because I am relatively new to SAS. </p>
  
  <p>Thanks in advance. </p>
  
  <p><a href="https://i.stack.imgur.com/iNY9E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iNY9E.jpg" alt="enter image description here"></a></p>