prog define getfrmt4diff , rclass
*	This subroutine parses the -frmttable- option so that the user can
*	override most of the options selected by -diffplot-.
*	Then it returns the -frmttable command line to subroutine -tradtable-,
*	which executes -frmttable- producing the output.
	version 14

	syntax  , [pvalues(name) pstars(numlist)  ///  -diffplot- options
		beforelbl(string) afterlbl(string) treatedlbl(string) controllbl(string)  ///  -diffplot- options
		hlines(passthru) vlines(passthru) replace  ///  -frmttable- options used by -diffplot-, but user can override
		annotate(passthru) asymbol(passthru) basefont(passthru)   ///
		ctitles(passthru) rtitles(passthru) note(passthru)  *]

	if "`verbose'"~="" {
		di as err `"In subroutine -getfrmt4diff-, the options catured by -*- are:"'  ///
			_n  `"`options'"'
	}

	if `"`asymbol'"'=="" {
	    local asymbol "*","**","***"
	}
	tokenize `"`asymbol'"', parse(`"," "')
	local i = 1
	while "`1'"~="" {
		if `i' > 3 {
			di as err "The option -asymbol- may contain only three symbols."
			exit 198
		}
		if "`1'"~="," & "`1'"~=`"""' {
			local s`i' `1'
			local i = `i' + 1
		}
		macro shift
	}
	return local asymbol asymbol(`s1',`s2',`s3')

	// Add footnotes to the table
	if "`tblnote'"=="" {
		local di_p1 = real("`pcrit1'")
		local di_p2 = real("`pcrit2'")
		local di_p3 = real("`pcrit3'")
		local note1 `s1' p < `di_p1';  `s2' p < `di_p2';  `s3' p < `di_p3'
		if "`substats'"~="" {
			foreach stat in `substats' {
				local ptxt `ptxt' `slsh' `stat'
				local slsh  /
			}
			local note2 `ptxt' displayed below estimated differences
		}
*		local note note("`note1'" \ "`note2'")
		if "`note2'"=="" {
			return local note "`note1'"
		}
		else {
			return local note "`note1'" \ "`note2'"
		}
	}

end /* End of program -getfrmt4diff- */