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

📄 _stubstar2names.ado

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 ADO
字号:
*! version 1.0.3  30mar2005
program _stubstar2names, sclass
	version 9
	syntax [anything(name=vlist)] [, ///
		nvars(integer 0) zero outcome SINGLEok ]

	if "`outcome'" == "" {
		local outcome equation
	}
	// check syntax
	if `"`vlist'"' == "" {
		local 0
		syntax newvarlist
		exit 100	// [sic]
	}

	if `nvars' <= 0 {
		di as err "invalid number of variables specified"
		exit 198
	}

	// parse vlist
	if index(`"`vlist'"',"*") {
		local stub 1
		// allow: [<vartype>] <stub>*
		//        [<vartype>] (<stub>*)
		gettoken first vlist : vlist, match(par) bind
		local dtypes double float
		if !`:list first in dtypes' {
			if `"`vlist'"' != "" ///
			 |`:word count `first'' != 1 {
				di as err "too many variables specified"
				exit 103
			}
			local type `c(type)'
			local vlist `"`first'"'
		}
		else {
			local type `first'
		}
		gettoken vlist rest : vlist, match(par) bind
		if `"`rest'"' != "" ///
		 |`:word count `vlist'' != 1 {
			di as err "too many variables specified"
			exit 103
		}
		if index("`vlist'","*") != `:length local vlist' {
			di as err "{it:stub}{bf:*} incorrectly specified"
			exit 198
		}
		local vlist = substr("`vlist'",1,length("`vlist'")-1)
		// turn <stub>* into `varlist' (<stub>1 <stub>2 ...)
		local varlist
		local typlist
		if "`zero'" == "" {
			local nlist "1/`nvars'"
		}
		else	local nlist "0/`=`nvars'-1'"
		forval i = `nlist' {
			local varlist `varlist' `vlist'`i'
			local typlist `typlist' `type'
		}
		confirm new var `varlist'
	}
	else {
		local stub 0
		// generate `typlist' and `varlist'
		local 0 `"`vlist'"'
		syntax newvarlist
		local kvars : word count `varlist'
		if `kvars' != `nvars' {
			if `kvars' == 1 {
				if "`singleok'" == "" {
					local problem 1
				}
				else	local problem 0
			}
			else	local problem 1
			if `problem' {
				capture noisily	///
				syntax newvarlist(min=`nvars' max=`nvars')
				if `nvars' > 1 & "`e(depvar)'" != "" {
					if "`e(cmd)'" != "" {
						local for "for `e(cmd)' "
					}
					di as err ///
"{p}the current estimation results `for'have `nvars' `outcome's so you " ///
"must specify `nvars' new variables, or you can use the `outcome'() " ///
"option and specify one variable at a time{p_end}"
				}
				exit c(rc)
			}
		}
	}

	sreturn clear
	sreturn local varlist	`varlist'
	sreturn local typlist	`typlist'
	sreturn local stub	`stub'
end
exit

⌨️ 快捷键说明

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