Probably a quicker way to label the variables is a variation on Sven's suggestion:
Run the following in file01 to construct a list of label commands on the screen ...
foreach var of varlist _all {
di "label `var' " `"""' "`: var label `var''" `"""'
}
Copy the list of commands, paste it in a do file and run it in file02.
-----------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Spiess, Sven Oliver
Sent: Wednesday, September 12, 2007 1:43 PM
To: [email protected]
Subject: st: FW: Assigning labels of 1 file into another file?
Hi Ziad,
In case you actually want to label variables not their 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 will work 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/
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.
*
* 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/