program define addstub
	version 7
	syntax [varlist] , stub(string)

	foreach var of local varlist {
		capture confirm new variable `stub'`var'
		if _rc > 0 {
			di as err "`stub'`var' is an invalid variable name"
			exit 198
		}
	}

	foreach var of local varlist {
		rename `var' `stub'`var'
	}
end