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]

RE: st: AW: AW: Display Variable Labels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: AW: AW: Display Variable Labels
Date   Thu, 27 May 2010 17:47:39 +0100

Sorry, yes. It's the other way round. 

"src" signals source (from), "dst" signals destination (to). 

By the way, using _crcslbl in a program is a bit lazy, as spelling out the implied syntax is more efficient. But you'd be pushed to notice the difference. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 27 May 2010 17:43
To: [email protected]
Subject: AW: st: AW: AW: Display Variable Labels


<> 

" Thus the syntax is 

_crcslbl fromvariable tovariable"



Maybe I am missing the point, but is the second variable really the
"tovariable"? (The -args- line calls it "src", presumably shorthand for
"source"?)

*************
clear*
gen  myvar=.
la var myvar ""
gen myvar2=.
la var myvar2 "my label for var2"
d
_crcslbl myvar myvar2
d
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nick Cox
Gesendet: Donnerstag, 27. Mai 2010 18:31
An: [email protected]
Betreff: RE: st: AW: AW: Display Variable Labels

-_crcslbl- is an non-documented command to copy one variable label to
another. 

CRC was the first name for the company that now is StataCorp. "slbl" is
evidently "same label". (The 8.3 filename.ext limit of DOS bit hard on early
command names.)  

Despite the lack of a help, the source code is instructive and sufficient. 

*! version 1.1.0  19dec1998
program define _crcslbl	/* varname varname */
	version 6
	args dst src
	local w : variable label `src'
	if `"`w'"' == "" {
		local w "`src'"
	}
	label variable `dst' `"`w'"'
end

Thus the syntax is 

_crcslbl fromvariable tovariable 

Nick 
[email protected] 

Martin Weiss

" What if I now want to copy the variable label from of pwvssn to a
variable called zpwvssn?"

Let`s give "weight" the -var label- of "mpg":

sysuse auto, clear
d mpg weight
la var weight "`: var l mpg'"
d mpg weight

You can also do things like -clonevar- which copies everything else as well.

Raphael Fraser

Thank you.

pwvssn is just one of 52 variables.

What if I now want to copy the variable label from of pwvssn to a
variable called zpwvssn?

On Thu, May 27, 2010 at 11:03 AM, Martin Weiss <[email protected]> wrote:

> BTW, Raphael, what kind of a -varlist- is "pwvssn" in your example? Does
it
> expand to more than one variable?

Martin Weiss

> See -help extended_fcn-:

> sysuse auto, clear
> foreach var of varlist _all{
>        di in r "`: var la `var''"
> }

Raphael Fraser

> foreach var of varlist pwvssn {
>        ...
>        display _newline(3) _column(4) as text "`var'"
>        ta diag, sum(`var')
>        ...
>        }
>
>
> How can I display the variable label rather than the variable name?

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

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