Create table stata 12
To export the regression output in Stata, we use the outreg2 command with the given syntax: outreg2 using results, word
Let us proceed towards using outreg2 by first running the following OLS regression, where the variable ‘price’ is regressed on five other independent variables: regress price mpg headroom trunk gear_ratio displacement This gives you a summary of data characteristics (variable types, labels, etc.). Let’s therefore describe the data through: describe It is good practice to observe the characteristics of the data before doing any data analysis on it. Where the option of clear ensures that any previous data in Stata’s memory that might still be loaded is erased. label variable foreign "the origin of the car, foreign or domestic"Īnd assign it to the variable foreign.To see how the command works, we will load the 1978 Automobile data from Stata through: sysuse auto.dta, clear label data "1978 auto data"Īssign a label to the variable foreign. SummaryĪssign a label to the data file currently in memory. When you save the data, all of the labels (data labels, variable labels, value labels) will be saved with the data file. To make these changes permanent, you need to One very important note: These labels are assigned to the data that is currently in memory. Ho: mean(domestic) - mean(foreign) = diff = 0 ttest mpg, by(foreign) Two-sample t test with equal variances Ttest, by(foreign) command, and the output labels the groups as domesticĪnd foreign (instead of 0 and 1). Value labels are used in other commands as well. Now when we use the tabulate foreign command, it shows the labels domestic car andįoreign car instead of just 0 and 1. describe Contains data from /stata/modules/autolab.dtaįoreign byte %12.0g foreignl the origin of the car, foreign or domestic If we use the describe command, we can see that the variable foreign has a value label calledįoreignl assigned to it. The label values command below associates the variable foreign with the label 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).
#Create table stata 12 how to#
This module will show how to create labels for your data.