title: Stata replace " " with missing values
body: <p>I have a large Stata dataset. In some variables the data has been coded with <code>" "</code> (space) instead than with missing values.   </p>
  
  <p>Is there any way to loop through each element of the dataset and replace it with the correct value?</p>
  
  <p>I need something like</p>
  
  <pre><code>for variable in all_variables:
     for sample in all_samples_of_variable:
         if sample == ' ' :
            replace sample with missing value
  </code></pre>