Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Assigning labels of 1 file into another file?


From   Sven-Oliver Spiess <[email protected]>
To   [email protected]
Subject   st: RE: Assigning labels of 1 file into another file?
Date   Wed, 12 Sep 2007 13:36:21 -0400

Hi Ziad,

In case you only want to label variables not values, I would probably try to
work with two loops.

In the first data set you could use,
	foreach var of varlist _all {
		local `var'label : variable label `var'
	}

then add a command to open your new file and run something like,
	foreach var of varlist _all {
		label `var' `"``var'label'"'
	}


Nevertheless, this would only work if your variables are named identically. If
you want to do that in separate do files use global macros instead. Also I'm not
sure if that works out with the quotes in the second loop but it's worth a shot.

I hope this can lead into the right direction.

Best
Sven-Oliver


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Ziad El-Khatib
> Sent: Wednesday, September 12, 2007 1:02 PM
> To: [email protected]
> Subject: st: Assigning labels of 1 file into another file?
> 
> Dear STATAlister
> I did lose records of a STATA file and now repeating the work again,
> to transfer the original file from Excel into STATA.
> To avoid re-labeling the variables again, is it possible to move the
> assigned labels from file01 into file02?
> 
> Thank you and best regards
> ziad
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index