Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: master labeling file of a string variable

From   Nick Cox <>
Subject   Re: st: master labeling file of a string variable
Date   Tue, 26 Jul 2011 12:10:18 +0100

You can't attach value labels to a numeric variable.


On Mon, Jul 25, 2011 at 6:59 PM, Lucie Vlach
<> wrote:
> Hello everyone!
> I have a problem trying to design a “master labelling file” that will label string values for me, uniformly, as I acquire datasets over time.
> I want to label values of a string variable. There are about 90 possible values at this time that I could have, but not all datasets that I will have, will utilize all full 90 labels. I could have a data set that will only use 26 of the 90 possible value labels. And some future datasets can use more.
> I want to be able to set up this 90-label file and draw on it when I am using a do file and appending the new data to a master file.
> I think the string variable gets assigned a number based on the size of the dataset at that time. Data set that has 20 unique values gets 1-20 numbers assigned, and the next dataset could only be 15, so 1-15 gets assigned, and so on, but 5 on one set is not 5 on the other set.
> encode  Health_Service_Code, gen(HSC_num)
> label define hsclabel ........
> 03.03A "Office visit not requiring complete (Automatic increase by 20% if>75)"
> 03.04A "Comprehensive visit physical q180d"
> 03.04J "Development documentation and admin of comprehensive SNIP office"
> 03.03B "Prenatal visit"
> 03.03C "Post-partum visit"
> ETC....
> label  values HSC_num hsclabel
> I want to make sure, that I always end up with ‘03.03B "Prenatal visit"’ to be value 4 and  ‘03.03C "Post-partum visit"’ as 5 and then it would be easy to label 5 as "Post-partum visit" etc etc…
> I would love to have the full 90 item label file as something my do files would access before appending to the master. Is this possible to do?
> Thank you all very much for your time. Much appreciated!

*   For searches and help try:

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