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: Generating labels


From   "Sarah Edgington" <[email protected]>
To   <[email protected]>
Subject   RE: st: Generating labels
Date   Tue, 27 Aug 2013 12:12:49 -0700

I don't think value labels will work for this task.  
If I'm understanding correctly, what Carlos wants to do is create a value
label for municip based on the text in municip2.  The problem is that the
values of municip2 vary within a given value of municip.  As far as I know
there's no way to attach multiple labels to a single value that are
different depending on the value of another variable (which is, in essence,
what would be required for value labels to work here).

What I don't understand is why the current data is problematic.  It looks
like the string variable municip2 already contains the desired text.  I
don't see how adding another string variable would help since it seems like
you already have the text you need.  If what you're looking for is a numeric
variable to represent the city names you could use -encode- to create a
unique numeric value for every city name in the dataset.

-Sarah



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Tuesday, August 27, 2013 11:29 AM
To: [email protected]
Subject: Re: st: Generating labels

Sounds as if you mean _value labels_. -search labmask- and see if it does
what you want. You need to download it before you can use it.

Nick
[email protected]


On 27 August 2013 19:22, Carlos Valencia <[email protected]> wrote:
> Hi, I'm new on stata
>
> I would like to add lables to some variables (or generate a new text 
> variable), which have the same code as in the example , but are in 
> fact, different, as in the example: The main city of the state 
> "Antioquia" coded by "1" is Medellin, and the main city of the state 
> "Cundinam" is 1 as well.
>
> YEAR MONTH SEX STATE       MUNICIP MUNICIP2
> 1996   11           0     Antioquia  1             Medellin
> 1988   7             1     Cundinam 1             Bogota
> 1982   4             1     Bolivar      1             ...
>
> Since there are many cities belonging to some municipalities using the 
> same value, how can I handle this, without changing all the cities 
> manually?
>
> Thanks by your help
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index