help head Sean Higgins

Title

head -- Prints the head observations (first observations in data set)

Syntax

head [varlist] [if] [in] [, options]

Income concepts
n(real) Number of observations to display (default is 10)

label Display value labels rather than values

unique Only display unique values

sorted Sort in ascending order of varlist

[no]header Display or do not display header (i.e., variable names); default is to display unless only one variable specified

Description

head displays the first n observations in the data set, where n is specified by
n(real) and has a default of 10. It was designed to mimic the head function in R.
For variables with value labels, the label option
can be used to list value labels rather than values. To only display unique values, specify
unique (e.g. if the first three values are 9, 9, 10 and n(2) and unique are
specified, the values displayed will be 9, 10 instead of 9, 9). Specifying sorted will
display the head observations of the data set after sorting it by varlist.
To not display the variable name header, specify noheader; the default is to display
the variable names unless varlist only contains one variable (to display the header if varlist
contains one variable, specify header).

Examples

. sysuse auto

. head price

. head price, n(2) header

. head price make, unique

. head price foreign, unique sorted label

. head price foreign, unique sorted noheader

Author

Sean Higgins, Tulane University, shiggins@tulane.edu