twoway_scatteri_parse.class
来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· CLASS 代码 · 共 112 行
CLASS
112 行
// twoway_scatteri_parse
//
// A parser for adding a immediate points/scatters. Works with twoway.ado.
*! version 1.0.0 23oct2002
version 8
class {
ptlist = ""
} , inherit(twoway_bar_parse)
// ---------------------------------------------------------------------------
program parse
.must_create_serset = 1
.viewtype = "scatter"
.allow_anything = 1 // side signal
.n = 1 // number of plots
.Super.parse `0'
if `"`.wtype'"' != "" {
di as error "weights not allowed"
exit 198
}
// process points
local pts `"`.anything'"'
gettoken y pts : pts
gettoken x pts : pts
while `"`x'"' != `""' {
// x-y point
capture numlist "`x' `y'" , max(2) min(2) missingok
if _rc {
di as error `"invalid point, `x' `y'"'
exit 198
}
// optional position
gettoken pos pts : pts , match(pfnd) quotes
if "`pfnd'" != "" {
capture numlist "`pos'" , max(1) min(1) range(>=0 <=12)
if _rc {
di as error `"invalid position, `pos'"'
exit 198
}
gettoken txtq pts : pts , quotes
.posnm = "position"
}
else {
local txtq `"`pos'"'
local pos .
}
gettoken txt : txtq // optional text label
if `"`txt'"' == `"`txtq'"' {
local ynxt `txt'
local txt
}
else {
.labvars[1] = "label"
gettoken ynxt pts : pts
}
local ptlist `"`ptlist' `"`y' `x' "`pos'" `"`txt'"'"'"'
local y `"`ynxt'"'
gettoken x pts : pts
}
.ptlist = `"`ptlist'"'
end
/* -------------------------------------------------------------------------*/
/*
Creates a new serset and the view and returns its reference.
Assumes that the data in memory is the same as when parse was called.
Allows a touse(varname) option that further restricts the sample,
restricts beyond the held .if and .in
Additional options to the .serset.new command may be specified, but
this is unlikely to be necessary.
If must_create_serset == 1, then this command MUST be used,
otherwise the serset may be created by other means.
*/
program log_create_serset
syntax , LOG(name) SERSETNAME(string) [ TOUSE(passthru) * ]
.varlist = "y x `.posnm' `.labvars[1]'"
.`log'.Arrpush __NOLOG__ twoway__scatteri_serset `.ptlist' , ///
x(x) y(y) pos(`.posnm') lbl(`.labvars[1]') ///
sersetname(`sersetname')
.`log'.Arrpush LogMapping .`sersetname' // make _fr_runlog place
// mapping statement into
// permanent log.
.wtype = "" // so .Super.log_create_view will
.wtexp = "" // not try to add weight to serset
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?