Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: describe using (problem with abbrev )
From
daniel klein <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: describe using (problem with abbrev )
Date
Tue, 3 Dec 2013 13:40:15 +0100
Alan,
this behavior is documented in -help describe-.
"The varlist in the describe using syntax differs from standard Stata
varlists in two ways. First, you cannot abbreviate variable names;
that is, you have to type displacement rather than displ. However, you
can use the wildcard character (~) to indicate abbreviations, for
example, displ~. Second, you may not refer to a range of variables;
specifying age-income is considered an error."
Here is a sketch how you could allow the dash character
*! version 1.0.0 03dec2013 Daniel Klein
pr descdash
vers 11.2
syntax anything using [, * ]
m : st_local("uservars", stritrim(st_local("anything")))
loc uservars : subinstr loc uservars "- " "-" ,all
loc uservars : subinstr loc uservars " -" "-" ,all
qui d `using' ,varl
loc allvars `r(varlist)'
token `uservars'
forv j = 1/`: word count `uservars'' {
loc var : subinstr loc `j' "-" " " ,c(loc dsh)
if (`dsh') {
loc f : list posof "`: word 1 of `var''" in allvars
loc t : list posof "`: word 2 of `var''" in allvars
if (`t' < `f') {
di as err "variables out of order"
e 111
}
m : st_local("var", ///
invtokens(tokens(st_local("allvars"))[(`f'..`t')]))
}
loc varlist `varlist' `var'
}
d `varlist' `using' ,`options'
end
e
descdash y1-y2 using ajit_112213
Best
Daniel
--
Hi _ In Stata 13 (and also in Stata 12), it appears that the
abbreviation with a dash "-" does not work with -describe using
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/