help mata Elabel_Syntax()

Title

Elabel_Syntax() -- Parse elabel syntax (class)

Syntax

class Elabel_Syntax scalar s

void
s.set(string scalar str_to_parse)

string rowvector
s.lblnamelist()

string rowvector
s.newlblnamelist()

string rowvector
s.labelnamelist()

string rowvector
s.varvaluelabel()

string scalar
s.anything()

string scalar
s.mappings()

string scalar
s.iff_eexp()

string scalar
s.filename()

string scalar
s.options()

void
s.newlblnameok(real scalar val)

real scalar
s.newlblnameok()

void
s.varvaluelabelok(real scalar val)

real scalar
s.varvaluelabelok()

void
s.anythingok(real scalar val)

real scalar
s.anythingok()

void
s.iffword(string rowvector iffword)

string rowvector
s.iffword()

void
s.usingword(string scalar usingword)

string scalar
s.usingword()

void
s.strict(real scalar val)

real scalar
s.strict()

void
s.broadmappings(real scalar val)

real scalar
s.broadmappings()

where val evaluates to true (val!=0) or false (val==0).

Description

Elabel_Syntax() returns instances of class Elabel_Syntax;
Elabel_Syntax() extends
Elabel_Unab(). The class is used for
developing the elabel package. See elabel parse
for the corresponding command. The functions call Stata's syntax
and reset the corresponding locals.

s.set() sets the string scalar str_to_parse that is to be
parsed. A str_to_parse contains the elements

[ elblnamelist ]
[ mappings ]
[ iff eexp ]
[ using filename ]
[ , options ]

where none of the elements needs to appear but when it appears it must
appear in the indicated postition.

s.set() without arguments is seldom called and returns
str_to_parse. The function might be called if you change the
settings and should be called if you change settings in
Elabel_Unab(); in that case, code:
s.set(s.set()).

s.lblnamelist() obtains the lblnamelist, if any, from
str_to_parse. In lblnamelist all value label names are
unabbreviated; any value label attached to varname is added if it
is indirectly specified. The function aborts with error if lblname
or (varlist) is invalid.

s.lblnamelist(0) returns lblnamelist including empty
columns if s.strict() included them; default is to omit
those empty columns.

s.newlblnamelist(), if new, not yet defined, value labels
are allowed in elblnamelist, returns any lblname in
elblnamelist that could not be matched.

s.newlblnamelist(0) returns newlblnamelist including empty
columns if s.strict() included them; default is to omit
those empty columns.

s.labelnamelist() is a convenience function and returns
(s.lblnamelist(0)+s.newlblnamelist(0))
if new, not yet defined, value labels are allowed in elblnamelist;
otherwise it returns s.lblnamelist(0).

s.varvaluelabel(), if s.varvaluelabelok()!=0 and
s.anythingok()==0 and s.broadmappings()==0, returns
a rowvector with elements varname [varname ...]
[new]lblname, ... from elblnamelist or
newlblnamelist.

s.anything(), if elblnamelist may contain anything,
obtains whatever is typed in str_to_parse in place of
elblnamelist and newlblnamelist run together; contents are
not checked but returned as typed.

s.mappings() obtains the mappings, if any, from
str_to_parse. Note that mappings are not checked for
errors but returned as typed.

s.iff_eexp(), if iffword!="", obtains eexp following
iffword (typically: iff), if any, from str_to_parse. The
function aborts with error if eexp is invalid.

s.iff_eexp(0) returns iffword eexp.

s.filename(), if usingword!="", obtains filename
following usingword (typically: using), if any, from
str_to_parse; filename is returned with quotes, if any.

s.filename(0) returns usingword filename.

s.options() obtains options, if any, from
str_to_parse. Returned is , options, that is, a comma
followed by a white space and options as typed; no checks are
performed.

s.options(0) returns options without a leading comma
and without leading white space.

s.newlblnameok() specifies whether elblnamelist may
contain new, not yet defined, value label names (val!=0) or not
(val==0, the default).

s.newlblnamesok() is a synonym.

s.varvaluelabelok() specifies whether
elblnamelist (or newlblnamelist, if allowed) may contain
variable-to-value-label-mappings of the form varname:lblname
(val!=0) or not (val==0, the default). The full diagram for such
mappings is

{(varlist) | varname} : elblname

where elblname must be exactly one value label name, and new,
not yet defined, value label names are allowed according to
s.newlblnameok(). You do not want to
s.varvaluelabelok(1) if s.anythingok()!=0 or
s.broadmappings()!=0.

s.anythingok() specifies whether elblnamelist may
contain anything (val!=0) or not (val==0, the default).

s.iffword() specifies the keyword indicating an iff
eexp. The default iffword is "iff"; if
iffword=="", iff eexp is treated as part of
elblnamelist or mappings.

If version is set to less than 16, iffword defaults to
("if", "iff").

s.usingword() specifies the keyword indicating using
filename. The default usingword is "" and specifies
that using filename is treated as part of elblnamelist
or mappings. usingword should be "" or "using".

s.strict(), if val!=0, returns an empty column for
each variable in (varlist) that has no value label
attached. The default, val==0, exits with error if one of the
variables in (varlist) has no value label attached.

s.broadmappings(), if val!=0, treats any element
in elblnamelist, newlblnamelist, or anything that
is not a name (possibly enclosed in parentheses and including
wildcard characters) as part of mappings. Default is val==0
and it is seldom changed.

s.nomem(), s.mlang(), and more are inherited from
Elabel_Unab(). If you call these functions,
you also want to code s.set(s.set()).

Conformability

As indicated above.

Diagnostics

Not documented; class functions are for internal use.

Source code

Distributed with the elabel package.

Author

Daniel Klein

University of Kassel

klein.daniel.81@gmail.com

Also see

Online: mata

if installed: elabel