Create new variables from format values
<p><strong>What i want to do:</strong> I need to create a new variables for each value labels of a variable and do some recoding. I have all the value labels output from a SPSS file (see sample). </p>

<p><strong>Sample:</strong> </p>

<pre><code>proc format; library = library ;
   value SEXF
      1 = 'Homme'  
      2 = 'Femme' ;
   value FUMERT1F
      0 = 'Non'  
      1 = 'Oui , occasionnellement'  
      2 = 'Oui , régulièrement'  
      3 = 'Non mais j''ai déjà fumé' ;
   value ... (many more with different amount of levels)
</code></pre>

<p>The new variable name would be the actual one without F and with underscore+level (example: FUMERT1F level 0 would become FUMERT1_0).</p>

<p>After that i need to recode the variables on this pattern:</p>

<pre><code>data ds; set ds;
    FUMERT1_0=0;
    if FUMERT1=0 then FUMERT1_0=1;

    FUMERT1_1=0;
    if FUMERT1=1 then FUMERT1_1=1;

    FUMERT1_2=0;
    if FUMERT1=2 then FUMERT1_2=1;

    FUMERT1_3=0;
    if FUMERT1=3 then FUMERT1_3=1;
run;
</code></pre>

<p>Any help will be appreciated :)</p>

<p>EDIT: Both answers from Joe and the one of data_null_ are working but stackoverflow won't let me pin more than one right answer.</p>