

label define foreignl 0 "domestic car" 1 "foreign car" Label define command below creates the value label called foreignl that associates 0 withĭomestic car and 1 with foreign car. This is a two step process where you first define the label, and then you assign the label to the variable. Let’s make a value label called foreignl to label the values of the variableįoreign. Rep78 int %8.0g the repair record from 1978įoreign byte %8.0g the origin of the car, foreign or domestic Mpg int %8.0g the miles per gallon for the car Price int %8.0gc the price of the car in 1978 describe Contains data from /stata/modules/autolab.dta The describe command shows these labels have been applied to the variables. label variable rep78 "the repair record from 1978" label variable price "the price of the car in 1978" label variable mpg "the miles per gallon for the car" label variable foreign "the origin of the car, foreign or domestic" Let’s use the label variable command to assign labels to the variables Obs: 74 This file contains auto data for the year 1978 The describe command shows that this label has been applied to the version that is currently in memory. label data "This file contains auto data for the year 1978" This label can be up to 80 characters long. Let’s use the label data command to add a label describing the data file. Variable name type format label variable label Size: 3,478 (99.9% of memory free) (_dta has notes) Let’s use the describe command to verify that indeed this file does not have any labels. Let’s use a file calledĪutolab that does not have any labels. Stata allows you to label your data file ( data label), to label the variables within your data file ( variable labels), and to label the values for your variables ( value labels).
#Stata xline label how to
quietly regress alcuse i.id#c.This module will show how to create labels for your data. Predicted values from this regression can then be plotted. In the nextĮxample, we regress alcuse on age interacted with id. We can also plot fitted lines using the xtline command. xtline alcuse if id < 10, overlay t(age) i(id) legend(off) scheme(s2mono) To do this, we add overlay to our command. Suppose we are interested in seeing all of the above lines in one plot. This example generates plots for the first 9 children’s observations in the file xtline alcuse if id < 10, t(age) i(id) scheme(s2mono) A separate plot will be created for eachĭifferent id value. The time variable we specify willĪppear on the horizontal axis. The outcome that we wish to examine,Īlcohol use, will appear on the vertical axis.

We indicate that our time variable is age with t(age) and our This first example shows a line connecting the three time points broken downīy id (one plot per child). Produces plots in grayscale, because publications often require monochromatic plots.įirst, we read in the data file.

Of alcohol use, alcuse, taken at ages 14, 15 and 16 for 82 children We will show a number of examples from a data file which contains a measurement The xtline command allows you to generate linear plots for panel data.
