*! version 1.0.0   01oct1997
* This program takes a varlist and creates variables corresponding to
* the squares and cross products of the included variables.  The names
* of the new variables are created by simply combining the names of
* the variables used to create the new variables.  This means that
* only variables with names of length 4 or less are allowed.
program define allcross
	version 5.0
	local varlist "req ex min(1)"
	parse "`*'"
	parse "`varlist'", parse(" ")
	preserve

	/* check for long names */
	local i 1
	while "``i''" != "" {
		if length("``i''") > 4 {
			di in red "variable name lengths must be < 5"
			exit 198
		}
		local i = `i' + 1
	}

	/* now form cross terms */
	local i 1
	while "``i''" != "" {
		local j `i'
		while "``j''" != "" {
			gen ``i''``j'' = ``i'' * ``j''
			local j = `j' + 1
		}
		local i = `i' + 1
	}

	restore, not
end