*! version 1.0.0  02/02/93  STB-13: dm13.1
program define exchstr
	local varlist "req ex min(2) max(2)"
	local if "opt"
	local in "opt"
	parse "`*'"
	confirm string variable `varlist'
	parse "`varlist'", parse(" ")

	tempvar hld
	quietly {
		local type : type `1'
		minlen `type' `2'
		local type : type `2'
		minlen `type' `1'
		local type : type `2'

		gen `type' `hld'=`1' `if' `in'
		replace `1'=`2' `if' `in'
		replace `2'=`hld' `if' `in'
		drop `hld'
		compress `1' `2'
	}
end