Bookmark and Share

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: RES: RE: RE: tab varname without the varname label


From   José Maria Pacheco de Souza <[email protected]>
To   <[email protected]>
Subject   st: RES: RE: RE: tab varname without the varname label
Date   Wed, 9 Feb 2011 10:36:07 -0200

Dear Nick:
Thank you very much.
I will try it. 

José maria

José Maria Pacheco de Souza 
Professor Titular, aposentado; Colaborador Sênior
Departamento de Epidemiologia/Faculdade de Saúde Pública/Universidade de São
Paulo
Av. Dr. Arnaldo, 715 - São Paulo, Capital - cep 01246-904
Fones: FSP= (11)3061-7747  Res= (11)3714-2403; (11)3768-8612
www.fsp.usp.br/~jmpsouza

-----Mensagem original-----
De: [email protected]
[mailto:[email protected]] Em nome de Nick Cox
Enviada em: quarta-feira, 9 de fevereiro de 2011 10:30
Para: '[email protected]'
Assunto: st: RE: RE: tab varname without the varname label

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/



*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index