title: SAS: convert a character variable to numeric, keep all 0's if the input has some fields with only 0's
body: <p>Objective: convert a character variable to numeric with proc sql in sas</p>
  
  <p>Conditions: </p>
  
  <ul>
  <li>The input variable has x lenght</li>
  <li>must keep all 0's in each position</li>
  <li>THERE ARE SOME FIELDS OF ONLY 0'S</li>
  </ul>
  
  <p>Ex:</p>
  
  <p>The table has one variable with the following:</p>
  
  <pre><code>'00000000'
  '00000000'
  '00000001'
  '20170617'
  '20151201'
  </code></pre>
  
  <p>The expected output is one variable with:</p>
  
  <pre><code>00000000
  00000000
  00000000
  00000001
  20170617
  20151201
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>PROC SQL;
  CREATE TABLE AAA AS
  SELECT input(field,z8.) as field_new
  FROM input_table
  QUIT;
  </code></pre>
  
  <p>But I get this undesired result:</p>
  
  <pre><code>0
  0
  0
  00000001
  20170617
  20151201
  </code></pre>