title: Converting character values to numeric in SAS
body: <p>i have a data set exam.</p>
  
  <p>the values are:
  (Both the variables are character)</p>
  
  <p>exam1<br>
  24<br>
  56<br>
  78<br>
  ND  </p>
  
  <p>exam2
  35
  56
  ND
  45 </p>
  
  <p>This is the task i have to perform:
  Using select statement,convert the exam values to numeric such that when exam value is ND, exam value must be assigned 0 otherwise it should just convert from character to numeric using the input function .</p>
  
  <p>I have tried with this code:</p>
  
  <pre><code>data work.ex(drop = Ex1 Ex2);
  
  set home.exam(rename=(exam1=Ex1) (exam2=Ex2))
  
  select ;
  
  when (exam1='ND') exam1=0;
  
  otherwise exam1=input(Ex1,3.0);
  
  end;
  </code></pre>
  
  <p>But this is not converting it to numeric</p>