-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathhead.ado
More file actions
31 lines (28 loc) · 765 Bytes
/
head.ado
File metadata and controls
31 lines (28 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
* PROGRAM TO DISPLAY HEAD OBSERVATIONS
*! v1.0.0 skh 30jan2016
capture program drop head
program define head
version 10
syntax [varlist] [if] [in] [, n(integer 10) NOHeader Header Label Unique Sorted]
if `n'<1 {
di as error in scml "{bf n} must be greater than or equal to 1"
exit
}
if "`label'"!="" local nolabel ""
else local nolabel nolabel
if "`varlist'"=="" local varlist _all
if wordcount("`varlist'")==1 & "`header'"=="" local header "noheader"
if "`if'`in'`sorted'`unique'"!="" {
preserve
}
if "`if'`in'"!="" {
qui keep `if' `in'
}
if "`sorted'"!="" {
qui sort `varlist'
}
if "`unique'"!="" {
qui duplicates drop `varlist', force
}
list `varlist' in 1/`n', clean noobs `nolabel' `header'
end