*! NJC 1.0.2 30 October 2002 *! NJC 1.0.1 26 October 2002 *! NJC 1.0.0 26 October 2002 program def vectorof version 7 gettoken cmd 0 : 0 syntax [varlist] [if] [in] [aweight fweight iweight pweight] /* */ [ , * Eclass(str) Rclass(str) Global(str) MATname(str) LISTWISE /* */ SAving(str asis) margin(str) TItle(str asis) /* */ x(varlist) y(varlist) /* */ noBlank noHAlf noHeader noNames Format(str) ] local nopts = /* */ ("`eclass'" != "") + ("`rclass'" != "") + ("`global'" != "") if `nopts' >= 2 { di as err "must specify one of eclass(), rclass() or global()" exit 198 } else if `nopts' == 0 { local graph "graph" } if "`graph'" != "" { if "`matname'" != "" { di as err "matname() incompatible with graph" exit 198 } } else { local nargs : word count `eclass' `rclass' `global' if `nargs' != 1 { foreach o in eclass rclass global { if "``o''" != "" { local which "`o'" } } di as err "specify one result in `which'()" exit 198 } } if "`listwise'" != "" { marksample touse, novarlist } else { marksample touse if "`x'`y'" != "" { markout `touse' `x' `y' } } qui count if `touse' if r(N) == 0 { di as err "no observations" exit 2000 } if "`graph'" != "" { local onoff : set graphics if `"`title'"' != "" { local t "title(`"`title'"')" } noisily capture { set graphics off foreach v of local varlist { tempfile g `cmd' `y' `v' `x' [`weight' `exp'] /* */ if `touse', `options' saving(`"`g'"') local G `"`G' "`g'""' } set graphics on if "`margin'" != "" { local m "margin(`margin')" } if `"`saving'"' != "" { local s "saving(`"`saving'"')" } gra using `G', `m' `s' } local rc = max(_rc, 0) if "`onoff'" == "on" { set graphics on } else set graphics off if `rc' { error `rc' } } else { local nv : word count `varlist' if "`matname'" == "" { tempname matname local header "noheader" } mat `matname' = J(`nv',1,1e309) if `"`options'"' != "" { local options `", `options'"' } local nv : word count `varlist' tokenize `varlist' if "`global'" != "" { forval i = 1 / `nv' { qui `cmd' `x' ``i'' `y' [`weight' `exp'] /* */ if `touse' `options' capture mat `matname'[`i',1] = $`global' } } else { local t = cond("`eclass'" != "", "e", "r") forval i = 1 / `nv' { qui `cmd' `x' ``i'' `y' [`weight' `exp'] /* */ if `touse' `options' capture mat `matname'[`i',1] = /* */ `t'(`eclass'`rclass') } } mat rownames `matname' = `varlist' mat colnames `matname' = `eclass'`rclass'`global' if "`format'" != "" { local format "format(`format')" } if `"`title'"' != "" { local title `"title(`title')"' } matrix li `matname', /* */ `blank' `header' `names' `half' `format' `title' } end