Stata's help files and PDF manuals include many worked examples that rely on datasets that either are installed with Stata or can be downloaded from the Stata website. You can type help dta_contents to see a description of these datasets.
. help dta_contents
This will open a Viewer window with three clickable links. You can click on "[U] 1.2.2 Example datasets" to view the PDF manual entry about example datasets included with Stata.
You can click on the link labeled "Example datasets installed with Stata", or type help dta_examples, to view a list of the datasets that are installed on your computer with Stata.
. help dta_examples
You can describe the contents of any of these datasets by clicking on the describe link next to the dataset, or in the Command window you can type sysdescribe followed by the name of the dataset to view the contents of the dataset without opening the dataset.
. sysdescribe auto.dta Contains data 1978 automobile data Observations: 74 13 Apr 2022 17:45 Variables: 12
Variable Storage Display Value | |||
name type format label Variable label | |||
make str18 %-18s Make and model price int %8.0gc Price mpg int %8.0g Mileage (mpg) rep78 int %8.0g Repair record 1978 headroom float %6.1f Headroom (in.) trunk int %8.0g Trunk space (cu. ft.) weight int %8.0gc Weight (lbs.) length int %8.0g Length (in.) turn int %8.0g Turn circle (ft.) displacement int %8.0g Displacement (cu. in.) gear_ratio float %6.2f Gear ratio foreign byte %8.0g origin Car origin | |||
You can load the dataset into Stata's memory by clicking on the use link next to the dataset, or you can type sysuse followed by the name of the dataset in the Command window.
. sysuse auto (1978 automobile data)
There are many more datasets available on the Stata website, and you can view a list of them, organized by manual title, by typing help dta_manuals.
. help dta_manuals
Let's click on Base Reference Manual [R] and then click on describe next to the dataset named "apple.dta". Or we can simply type webdescribe apple in the Command window. Note that you will need an Internet connection to do this.
. webdescribe apple Contains data Apple trees Observations: 10 16 Jan 2022 11:23 Variables: 2
Variable Storage Display Value |
name type format label Variable label |
treatment int %8.0g Fertilizer weight double %10.0g Average weight in grams |
This will display the contents of the apple dataset without loading the dataset into Stata's memory.
You can open the dataset by typing webuse apple. Note that you may need to include the clear option if you already opened the auto dataset.
. webuse apple, clear (Apple trees)
You can watch a demonstration of these commands by clicking on the link to the YouTube video below. You can read more about these commands by clicking on the links to the Stata manual entries below.
Read more in the Stata Base Reference Manual; see [R] Example datasets, [R] sysuse, and [R] webuse.