changing all n_0 value that is a char in a data set to a N_1 value that is a numeric value for the entire data set
<p>Suppose you import some file, and have the variables </p>

<pre><code>name room# test1 test2 test3 
</code></pre>

<p>and n observations.</p>

<p>The name is a name, the room number is a room number of length 3 and test1 - test3 are scored from 0 - 100. </p>

<pre><code>name room# test1 test2 test3
bob  123   90    40     33
bob2 123   a     40     90 
bob3 123   88    k      78
..    
</code></pre>

<p>Now, suppose I want to find all the instances of the letter <code>k</code> and replace them with a numeric value zero. How can this be done? I am doing this during the initial data step by using if then statement, i.e.</p>

<pre><code>data temp;
   infile = "...." ; 
   if test1 = k then test1=0; 
   if test2 = k then test2=0; 
   if test3 = k then test3=0; 
run;
</code></pre>

<p>Is there a better way of doing this ? </p>