filename myinput "c:\emails.txt"; filename myoutput "c:\parsed.txt"; data _null_; /* not creating a SAS dataset */ infile myinput; /* input a flatfile */ file myoutput; /* output a flatfile */ length email $40; input email $; /* input has email only */ atsign = index(email,"@"); /* position of at sign */ name = substr(email,1,atsign-1); /* name preceded at sign */ remains = substr(email,atsign+1); /* what's left */ period = index(remains,"."); /* period after at sign */ domain = substr(remains,1,period-1); /* isolate domain */ type = substr(remains,period+1); /* type follows period */ put @1 name $20. @21 domain $20. @41 type $3.; /* write it */ run;