*! version 3.0.0  4/23/92 Hilbe
capture program drop unfold
program define unfold
	version 3.0
	local varlist "req ex min(2)"
	parse "`*'"
	parse "`varlist'", parse(" ")
	confirm new var _`1'
	confirm new var _`2'
	local k = _N
	local k1 = _N + 1
	quietly expand =2, clear

	capture {
		gen byte _`1'=0 in 1/`k'
		replace _`1'=1 in `k1'/l
		gen _`2'=`2'-`1' in 1/`k'
		replace _`2'=`1' in `k1'/l
		mac shift
		mac shift

	}
	noisily di in bl " Blocked data unfolded..."
	local rc = _rc
	error `rc'

end