*! version 1.0.0 02/02/93 extrname utility; STB-13: dm13 program define _crcexnc /* lname sx flg wrd cwrd */ version 3.0 local ln "`1'" local sx "`2'" local flg `3' local wrd "`4'" local cwrd "`5'" tempvar bad quietly { local l=length(" `wrd'") gen byte `bad'=substr(`ln',length(`ln')-`l'+1,.)==" `wrd'" if `flg'==0 { replace `bad'=0 if `sx'!="" } capture assert `bad'==0 if _rc==0 { exit } local type : type `sx' local cl=length(" `cwd'")+real(substr("`type'",4,.)) minlen `cl' `sx' replace `sx'=trim(`sx'+" `cwrd'") if `bad' replace `ln'=trim(substr(`ln',1,length(`ln')-`l')) if `bad' compress `sx' `lname' } end