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]

st: master labeling file of a string variable

From   Lucie Vlach <>
To   "" <>
Subject   st: master labeling file of a string variable
Date   Mon, 25 Jul 2011 11:59:29 -0600

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"
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!


This message and any attached documents are only for the use of the intended recipient(s), are confidential and may contain privileged information. Any unauthorized review, use, retransmission, or other disclosure is strictly prohibited. If you have received this message in error, please notify the sender immediately, and then delete the original message. Thank you.

*   For searches and help try:

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