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

📄 tsreport.ado

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 ADO
字号:
*! version 6.0.5  29sep2004
program define tsreport, rclass
	version 6, missing

	syntax [if] [in] [, Detail List Panel Report REPORT0 ]

	marksample touse
	_ts timevar panvar, panel sort
	markout `touse' `timevar'

	* ChkSort `timevar' `panvar'

	if "`panel'" != "" & "`panvar'" != ""  {
		local bypfx "qui by `panvar': "
	}
	else    local bypfx "qui "  

	/* find gaps.  gaps are defined as places where the lagged observation
	 * is not flagged for use */

	tempname gap
	gen byte `gap' = `touse' & l.`touse' != 1
	`bypfx' replace `gap' = 0  if sum(`touse') <= 1

	qui count if `gap'
	return scalar N_gaps = r(N)

	if return(N_gaps) > 0 {
		if "`report'`report0'" != "" {
			di in gr _n "Number of gaps in sample:  " /*
				*/ in ye return(N_gaps) _c
			if "`panel'" == "" & "`panvar'" != "" {
				di in gr "   (gap count includes panel changes)"
			}
			else	di
		}

		if "`list'`detail'" != "" {
			if "`panel'" == "" & "`panvar'" != "" {
				di in gr /*
				*/ _n "Observations with preceding time gaps"
				di in gr "(gaps include panel changes)" _c
			}
			else {
				di in gr _n "Observations with preceding " /*
					*/ "time gaps" _c
			}

			tempvar recnum
			qui gen long `recnum' = _n  if `gap'
			lab var `recnum' "Record"

			if "`panvar'" != "" {
				tabdisp `recnum', cell(`panvar' `timevar'), /*
					*/ if `gap'
			}
			else {
				tabdisp `recnum', cell(`timevar'), if `gap'
			}
		}
		
	}
	else if "`report0'" != "" {
		di in gr _n "Number of gaps in sample:  " in ye return(N_gaps)
	}


end

exit


/* ChkSort, either exits with an error or returns quietly on success (data is
   properly sorted */

program define ChkSort
	args	timevar panel

	local sortby : sortedby
	tokenize `sortby'

	if "`panel'" != "" {
		if "`panel'" != "`1'" | "`timevar'" != "`2'" {
			di in red "data not sorted for panel "  /*
				*/ "time-series"
			di in red "use -tsset- or -sort `panel' "/*
				*/ "`timevar'-"
			exit 5
		}
	}
	else if "`timevar'" != "`1'" {
		di in red "data not sorted for time-series; "  /*
			*/ "must use -tsset- or -sort `timevar'-"
		exit 5
	}
end


⌨️ 快捷键说明

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