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]
st: RE: RE: tab varname without the varname label
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: RE: tab varname without the varname label
Date
Wed, 9 Feb 2011 12:29:41 +0000
This could mimic oneway and twoway -tabulate-. I don't think it's a very attractive idea personally, but the main point is that Stata offers you the tools to do it yourself.
Same reservation: very little tested.
program jmptab
version 8.2
syntax varlist(min=1 max=2) [if] [in] [fweight aweight iweight] [, *]
qui foreach v of local varlist {
tempvar clone
clonevar `clone' = `v'
label var `clone' "`v'"
local clones `clones' `clone'
}
tab `clones' `if' `in' [`weight' `exp'] , `options'
end
Nick
[email protected]
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
I don't think there is such an option, but this is programmable. Just clone the variable in a temporary variable, strip it of its variable label and fire up the command. Strictly you need a new variable label that is the name, but the effect is as you wish.
Rough demonstration sketch, largely untested:
program jmptab
version 8.2
syntax varname [if] [in] [fweight aweight iweight] [, *]
tempvar clone
clonevar `clone' = `varlist'
label var `clone' "`varlist'"
tab `clone' `if' `in' [`weight' `exp'] , `options'
end
Nick
[email protected]
José Maria Pacheco de Souza
Is there some option in tab that presents the real name of a variable
instead of the label attached to it? Something alike -tab varname, nolab-
used to present a tabulation not using the values label.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/