Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: master labeling file of a string variable


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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.

Nick

On Mon, Jul 25, 2011 at 6:59 PM, Lucie Vlach
<Lucie.Vlach@albertahealthservices.ca> 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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index