⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _get_gropts.ado

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 ADO
字号:
*! version 1.1.6  12may2005
program _get_gropts, sclass
	version 8.0

	syntax [,				///
		graphopts(string asis)		/// graph options
		grbyable			/// -by()- is allowed
		nobycheck			///
		TOTALallowed			/// -by(, total)- is allowed
		MISSINGallowed			/// -by(, missing)- is allowed
		getbyallowed(namelist local)	/// get -<opt>()- from -by()-
		getcombine			/// get -graph combine- options
		gettwoway			/// get -twoway_options-
		getallowed(namelist local)	/// get -<opt>()-
	]

	local globalopts `getcombine' `gettwoway'
	if `: word count `globalopts'' > 1 {
		di as err ///
		"options `: list retok globalopts' may not be combined"
		exit 198
	}

	// The following options are all supposed to be unique
	foreach ALLOWED of local getallowed {
		local allow_opts `"`allow_opts' `ALLOWED'(string asis)"'
		local RGETALL `"`RGETALL' `=lower("`ALLOWED'")'"'
	}
	foreach ALLOWED of local getbyallowed {
		local byallow_opts `"`byallow_opts' `ALLOWED'(passthru)"'
		local RGETBY `"`RGETBY' `=lower("`ALLOWED'")'"'
	}

	local 0 `", `graphopts'"'
	syntax [,			///
		by(string asis)		///
		`allow_opts'		/// -getallowed()- options
		*			///
	]
	local graphopts `"`options'"'

	if `"`grbyable'"' == "" & `"`by'"' != "" {
		di as err `"option by() not allowed"'
		exit 191
	}

	// parse the -by()-
	local 0 `by'
	syntax [varlist(default=none)] [,	///
		total				///
		MISSing				///
		*				///
	]

	local byvars `varlist'
	local bytotal `total'
	local bymissing `missing'

	if `"`bycheck'"' == "" &	///
	   `"`byvars'"'  == "" &	///
	   `"`bytotal'`bymissing'`options'"' != "" {
		di as err `"invalid syntax: by(`0')"'
		exit 198
	}
	local 0 , `options'
	syntax [,			///
		`byallow_opts'		/// -getbyallowed()- options
		*			///
	]
	local byopts `"`options'"'

	if `"`totalallowed'"' == "" & `"`bytotal'"' != "" {
		di as err ///
`"total option not allowed inside the by() option"'
		exit 191
	}

	if `"`missingallowed'"' == "" & `"`bymissing'"' != "" {
		di as err ///
`"missing option not allowed inside the by() option"'
		exit 191
	}

	// Get -graph_combine- options
	if "`getcombine'" != "" {
		GetPassThruOptions ,			///
			uniqueargopts(			///
				Rows			///
				Cols			///
				HOLes			///
				IMargins		///
				SCALE			///
				ISCALE			///
				SCHeme			///
				name			///
				SAVing			///
				SPACErs			///
			)				///
			switchopts(			///
				COLFirst		///
				altshrink		///
				YCOMmon			///
				XCOMmon			///
				COPies			///
				COMmonscheme		///
				nodraw			///
			)				///
			repeatargopts(			///
				R1title			///
				R2title			///
				L1title			///
				L2title			///
				T1title			///
				T2title			///
				B1title			///
				B2title			///
				NOTE			///
				CAPtion			///
				SUBtitle		///
				Title			///
				YSIZe			///
				XSIZe			///
				GRAPHRegion		///
				PLOTRegion		///
			)				///
			graphopts(`graphopts')		///
			// blank
		local combineopts `"`s(found)'"'
		local graphopts `"`s(graphopts)'"'
	}

	// Get -twoway_options-
	if "`gettwoway'" != "" {
		// repeatable argumented options are automatically handled by
		// by -graph twoway-
		GetPassThruOptions ,			///
			uniqueargopts(			///
				SCALE			///
				SCHeme			///
				name			///
				SAVing			///
			)				///
			switchopts(			///
				nodraw			///
			)				///
			repeatargopts(			///
				R1title			///
				R2title			///
				L1title			///
				L2title			///
				T1title			///
				T2title			///
				B1title			///
				B2title			///
				NOTE			///
				CAPtion			///
				SUBtitle		///
				Title			///
				YSIZe			///
				XSIZe			///
				GRAPHRegion		///
				PLOTRegion		///
			)				///
			graphopts(`graphopts')		///
			// blank
		local twowayopts `"`s(found)'"'
		local graphopts `"`s(graphopts)'"'
	}

	// Saved results
	sreturn clear
	foreach ALLOWED of local RGETALL {
		sreturn local `ALLOWED' `"``ALLOWED''"'
	}
	sreturn local combineopts `"`:list retok combineopts'"'
	sreturn local twowayopts `"`:list retok twowayopts'"'
	sreturn local graphopts `"`graphopts'"'
	sreturn local byopts `"`byopts'"'
	foreach ALLOWED of local RGETBY {
		sreturn local by_`ALLOWED' `"``ALLOWED''"'
	}
	sreturn local missing `"`bymissing'"'
	sreturn local total `"`bytotal'"'
	sreturn local varlist `"`byvars'"'
end

program GetPassThruOptions, sclass
	syntax [,			///
		uniqueargopts(string)	///
		switchopts(string)	///
		repeatargopts(string)	///
		graphopts(string asis)	///
	]

	foreach opt of local uniqueargopts {
		local USPECS `"`USPECS' `opt'(passthru)"'
		local UNAMES `"`UNAMES' `=lower("`opt'")'"'
	}
	foreach opt of local switchopts {
		local USPECS `"`USPECS' `opt'"'
		local UNAMES `"`UNAMES' `=lower("`opt'")'"'
	}
	foreach opt of local repeatargopts {
		local RSPECS `"`RSPECS' `opt'(passthru)"'
		local RNAMES `"`RNAMES' `=lower("`opt'")'"'
	}

	// parse unique (argumented) and swith options
	local 0 `", `graphopts'"'
	syntax [, `USPECS' * ]
	foreach opt of local UNAMES {
		if `"``opt''"' != "" {
			local UFOUND `"`UFOUND' ``opt''"'
		}
	}

	// parse repeatable argumented options
	local 0 `", `options'"'
	local FOUND 1
	while `FOUND' {
		local FOUND 0
		syntax [, `RSPECS' * ]
		foreach opt of local RNAMES {
			if `"``opt''"' != "" {
				local RFOUND `"`RFOUND' ``opt''"'
				local FOUND 1
			}
		}
		if `"`options'"' == "" {
			local FOUND 0
		}
		else {
			local 0 `", `options'"'
		}
	}
	sreturn local found `"`: list retok UFOUND' `: list retok RFOUND'"'
	sreturn local graphopts `"`options'"'
end

exit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -