describe
Lists every column: its name, what kind of thing it holds, and what it means.
What we have
- every variable with its storage type, display format, label and value label
- the number of observations and variables
- the file the data was read from
Coming later
format— the display format is shown but there is no command to change itcompress
You may shorten it to d.
How you write it
describe
Square brackets mean optional. A vertical bar means choose one.
What it does
The first command to run on a file you did not create. In a few lines it tells you how many rows there are (observations), how many columns (variables), what each one is called, whether it holds numbers or text (its storage type), the description someone attached to it, and whether its numbers stand for words (value labels).
Run it before anything else and you will not waste an afternoon averaging a column that turned out to be text.
Try it
Every example below was run after sysuse vira.sample02, clear.
. describe
Contains data from .../virata/datasets/vira.sample02.dta
Observations: 6,000
Variables: 11
------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
------------------------------------------------------------------------------
village long %9.0g First-stage unit (village/b~
stratum str %9s Stratum
state str %9s State
sector long %9.0g Sector: 1 rural 2 urban
sex long %9.0g Sex: 1 male 2 female
age long %9.0g Age in years
education long %9.0g Years of education
hhsize long %9.0g Household size
mpce double %9.0g Monthly per capita expendit~
wage double %9.0g Weekly wage
multiplier double %9.0g Survey multiplier
------------------------------------------------------------------------------
The same thing in pandas and in R
pandas
df.dtypes
R
library(dplyr) glimpse(df) # This R has NOT been run against a real R yet: read it as documentation.