Statalist


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

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


From   Ziad El-Khatib <[email protected]>
To   [email protected]
Subject   Re: st: RE: Assigning labels of 1 file into another file?
Date   Thu, 13 Sep 2007 08:56:40 -0700

Hi Sven-Oliver,
Thank you for your kind reply.
I guess I am not sure about the difference in terms here but great you
pointed it out, but I will explain myself in giving an example:
 1. how can I save the codes assigned for each variable and use them
in the other file, example:
How to save the code of variable 'studyid' that means "Patient ID number", etc..

and

 2. how to save the values of variables, for example:
How to save the value of variable 'education' as 1) highschool, 2)
university, 3) illiterate


I want to use lists 1 and 2 in the other file because 100% the same
except it has extra records.


Thank you and best regards
ziad





On 9/12/07, Sven-Oliver Spiess <[email protected]> wrote:
> 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/
>


-- 
Ziad El-Khatib
AIDS Unit
National Institute for Communicable Diseases (NICD)
1 Modderfontein Road
Private Bag X4, Sandringham, 2131
Johannesburg, South Africa
Mobile: +27 (0) 72-52 39 716
Phone: +27 (0) 11-386 6433
Fax (NICD): +27 (0)11 386 6453
Fax (alternative): +27 (0)866 18 2871
http://www.nicd.ac.za/

Division of International Health (IHCAR)
Karolinska Institutet
www.phs.ki.se/ihcar

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