Statalist


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

Re: st: Re: value labels from another dataset


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   Re: st: Re: value labels from another dataset
Date   Sat, 20 Sep 2008 17:46:59 +0200

It is easy enough to identify the position of the -label- command in collapse.ado, but it is not good practice to touch official files. So try this little program after -collapse- and tweak it to your needs.

********
pr backtoorig
vers 10.1
args varname
la var `1' "`=substr("`: var l `1''", strpos("`: var l `1''",")")+2, length("`: var l `1''"))'"
end

*********

*********
sysuse auto, clear
collapse (p25) gear_ratio, by(rep)
backtoorig gear_ratio
sysuse auto, clear
collapse (p25) gear_ratio, by(rep)
describe
backtoorig gear_ratio
describe
**********

Martin Weiss
_______________________
----- Original Message ----- From: "Ashim Kapoor" <[email protected]>
To: <[email protected]>
Sent: Saturday, September 20, 2008 11:54 AM
Subject: Re: st: Re: value labels from another dataset



I have a question. After I do -collapse- I want the labels to remain the same.

Suppose I do

collapse (first) state by ( year )

I want the label of state to remain " State " and not become (first)
state. How do I do this ?

Thank you,
Ashim.

On Sat, Sep 20, 2008 at 3:13 PM, Martin Weiss <[email protected]> wrote:

The description is a little hazy, but he tools in data -> labels -> label
values should be sufficient. First turn the string var and the numeric codes
into a -value label-. -encode- might also be helpful for this exercise. Then
-label save- the -value labels- and run the do file on the first dataset.

Martin Weiss
_______________________
----- Original Message ----- From: "Mendoza Aldana, Dr Jorge Antonio (WPRO)"
<[email protected]>
To: <[email protected]>
Sent: Saturday, September 20, 2008 9:14 AM
Subject: st: value labels from another dataset



Dear all,
my apologies if this has been already covered. I will appreciate its
address if so.
I have a large dataset with numeric codes for a geographical division. In
another dataset I have the same codes and a string variable with the name
for each geographical division. Is there a way of using the name of the
division from the second dataset in the first dataset?.

Thank you very much in advance

Jorge



====================================================
This message was scanned for viruses with Trend Micro ScanMail, GFI
MailSecurity and GFI MailEssentials by the World Health Organization
Regional Office for the Western Pacific. However, the recipient is advised
to scan this e-mail and any attached files for viruses.

Disclaimer:

This e-mail, together with any attachments, is intended for the named
recipients only and is confidential. It may also be privileged or otherwise
protected by law.

If you have received it in error, please notify the sender immediately by
reply e-mail and delete it and any attachments from your system. You may not
copy or disclose its contents to anyone.


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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index