mardi 10 novembre 2015

Wildcard for an if else statement in sas data step

I want to code a new variable from survey data based on a certain string, but including a wildcard for additional information before and after that string using a sas data step. The following code works matching the pattern at the beginning of the string

data survey_data;
    set final_data;
        if 'var1' =: 'this string' then var2 = 'Yes';
        else var2 = 'No';   
run;

But I'm not sure how to get it to match the pattern if it occurs in the middle of the string, ':=:' does not work.

Aucun commentaire:

Enregistrer un commentaire