creating variable labels in stata

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to discuss how to assign variable labels and how to create an assign value label so the first thing we'll start with is opening up data set click on your file icon choose the data set that you want to open which is choice data set click open and you'll notice that you see in your results window that the data set has been open the first thing that I always like to do is open up my data browser and make sure that the data looks appropriate all right so we're going to close that and open up the variables manager that's indicated by this icon up here in the icon toolbar okay so what we see here in the variables manager is a list of all the variables that we have any labels that are associated with them the type the format and any values that are associated with those labels on the very right hand side are the variable property so the next thing that I'd like to show you is how to add a label to a variable the first variable that we're going to deal with is the choice variable so if you click on the choice variable you can just go over to the variables property window and click in the label box and assign a label to that variable we're going to call this variable lease say for example whether somebody leased or bought their vehicle and simply click apply you'll notice that on the left-hand side of the variables manager window that this was applied to the choice variable under the label column now the next thing we want to go do is add a label to our first variable so we're going to click on first so over to the label box under variable properties and we're going to give this label a more descriptive label of first-time buyer first is not a very descriptive variable name and our labels want to be something a little bit more descriptive so that we understand what our variables actually mean then we go down and hit apply so now again we see that under the label column this variable label has been applied the next thing that we're going to do is we want to assign value labels to our variable in order to do this it's a multi-step process we first have to create the value label and then assign the label to a variable in order to do that we're going to first create the value label and we do that by clicking the manage button you'll notice that a new window appear and what we have to do is click on create the label now we're going to create a label that can be used for multiple different variables this is often true say for a label such as yes/no 0 1 that can be applied to several different kinds of variables and that's what we're going to do the value name is going to be called yes/no and we're going to give a value then of 0 and the label will be known and then we click Add now we have to assign what the yes value will be and we go into our value box and type in 1 then go down to the label box and type in yes and then we click Add so you'll notice it on the left hand side the value of 0 is assigned a label of no and the value of 1 is assigned a label of yes now we click OK again we're back to our manage value labels window and we see our value label of yes/no if you click raus icon then it'll expand what your value label values are and again you can easily see that 0 is no and 1 is yes this is a great way to check what your value label options are now you can go on to create another label you can edit your label if after checking you see that you've assigned a wrong value or you can drop the label if you no longer want to use that value label now we're going to close it because we want to go ahead and assign this value label to a variable if I don't assign it to a variable then I'm not going to actually be using it in my data before we actually assign it I want go back to the data browser and show you what our data look like before and after assigning a value label so let's close our variables manager go to our data browser browse and what you'll see is if we look at our first variable column these are all first-time buyers yes/no but this is entered as numeric data and again I want you to remember there's numeric data and Stata are always shown in black numbers also for choice remember we gave this a label of Lise these are numeric values so they are shown in black numbers let's go ahead and close that open up our variable manager and now we're going to assign our value label to our variable let's start with first-time buyer now we go ahead and assign that value label to our variable by choosing the variable that we're interested in we chose first-time buyer then we go over to the variables property window and we choose this down arrow which will give us all of the value labels that have been created so far we've only created one so yes/no is an option we choose yes/no and then we click apply what you'll immediately see is on the left hand side of your window under value label column yes/no has been populated so for the variable first the label is first-time buyer and the value label is yes/no what I'd like you to see now is if we go back to the data editor browse under the first variable the values are now blue instead of black as they were before and instead of seeing ones and zeros you see nose and yeses they're still stored ins in Stata as ones and zeros but it's just easier for us to read and for printout and at our tables with knows--and yeses and this is how you assign variable labels and value labels to variables in Stata thanks for listening
Info
Channel: monikj11
Views: 19,605
Rating: 4.6226416 out of 5
Keywords: stata, variables, statistical software
Id: 4uXTQWD84Sw
Channel Id: undefined
Length: 6min 51sec (411 seconds)
Published: Tue Sep 13 2011
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.