You can't re-type a varaible from char to num or vice-versa, so you have to rename the vars, thereby freeing up the original varnames to use with the new var type. Below shows how:
The SCAN functions is asking for the 2nd "word" in col2, where it defines word-separators as the character "M".
regards,
Mark
data have1;
infile datalines;
format MailOrderIndicator $1. FilledMonth $7.;
input MailOrderIndicator $ FilledMonth $;
datalines;
N 2016M09
Y 2016M09
;
run;
data want;
set have1 (rename=(mailorderindicator=col1 filledmonth=col2));
mailorderindicator=ifn(col1='Y',1,0);
filledmonth=input(scan(col2,2,'M'),2.);
run;
... View more