All commands
# |
content
|
3 [+]
|
clear
All properties
key |
content |
command |
clear |
indent |
0 |
parameters |
|
|
4 [+]
|
use
ex_employee
, clear
All properties
key |
content |
command |
use |
indent |
0 |
options |
clear |
parameters |
ex_employee |
|
5 [+]
|
generate
byte beginspell = employer != employer[_n-1]
|
6 [+]
|
list
, sepby(employer) noobs
|
8 [+]
|
generate
byte beginunemp = missing(employer) & ((employer != employer[_n-1]) | (_n == 1))
|
9 [+]
|
list
if beginunemp
, sep(0)
All properties
key |
content |
command |
list |
if |
beginunemp |
indent |
0 |
options |
sep(0) |
parameters |
|
|
11 [+]
|
generate
spellnr = sum(beginspell)
|
12 [+]
|
list
, sepby(employer) noobs
|
14 [+]
|
bysort spellnr:
egen
meanwage = mean(wage)
|
15 [+]
|
format
meanwage %5.2f
All properties
key |
content |
command |
format |
indent |
0 |
parameters |
meanwage %5.2f |
|
16 [+]
|
list
, sep(0) noobs
All properties
key |
content |
command |
list |
indent |
0 |
options |
sep(0) noobs |
parameters |
|
|
18 [+]
|
sort
spellnr
All properties
key |
content |
command |
sort |
indent |
0 |
parameters |
spellnr |
|
19 [+]
|
by spellnr:
gen
length = _N
if !missing(employer)
|
20 [+]
|
generate
byte longspell = (length >= 3 & !missing(length))
|
21 [+]
|
list
year employer length longspell
, sepby(employer) noobs
|
23 [+]
|
save
ch44
, replace
All properties
key |
content |
command |
save |
indent |
0 |
options |
replace |
parameters |
ch44 |
|
26 [+]
|
use
ch45
, clear
All properties
key |
content |
command |
use |
indent |
0 |
options |
clear |
parameters |
ch45 |
|
|
|
29 [+]
|
list
fam person female age
, sepby(fam) noobs
|
31 [+]
|
drop
nadult nchild sibs nboys nbros older oldestchild oldestsibling
|
32 [+]
|
sort
fam
All properties
key |
content |
command |
sort |
indent |
0 |
parameters |
fam |
|
33 [+]
|
by fam:
egen
nadult = total(age >= 18)
All properties
key |
content |
command |
egen |
indent |
0 |
parameters |
nadult = total(age >= 18) |
prefix |
by fam: |
|
34 [+]
|
by fam:
egen
nchild = total(age <= 17)
if age <= 17
|
35 [+]
|
generate
sibs = nchild - 1
All properties
key |
content |
command |
generate |
indent |
0 |
parameters |
sibs = nchild - 1 |
|
36 [+]
|
by fam:
egen
nboys = total(age <= 17 & !female)
if age <= 17
|
38 [+]
|
by fam:
egen
nbros = total(age <= 17 & !female)
if age <= 17
|
39 [+]
|
replace
nbros = nbros - (age <= 17 & !female)
All properties
key |
content |
command |
replace |
indent |
0 |
parameters |
nbros = nbros - (age <= 17 & !female) |
|
42 [+]
|
sort
fam (age)
All properties
key |
content |
command |
sort |
indent |
0 |
parameters |
fam (age) |
|
43 [+]
|
by fam:
g
older = (age <= 17 & age[_n+1] <= 17) * (age < age[_n+1])
|
45 [+]
|
by fam:
egen
oldestchild = max(age)
if age<=17
|
46 [+]
|
g
oldestsibling = cond(age < oldestchild & age <= 17, oldestchild, .)
|
48 [+]
|
list
fam female age nadult sibs nboys nbros older oldestsibling
, sepby(fam) noobs
|
49 [+]
|
save
ch45
, replace
All properties
key |
content |
command |
save |
indent |
0 |
options |
replace |
parameters |
ch45 |
|
51 [+]
|
use
gdp4cty
, clear
All properties
key |
content |
command |
use |
indent |
0 |
options |
clear |
parameters |
gdp4cty |
|
52 [+]
|
keep
cty gdp date
All properties
key |
content |
command |
keep |
indent |
0 |
parameters |
cty gdp date |
|
53 [+]
|
levelsof
cty
, local(gdplist)
All properties
key |
content |
command |
levelsof |
indent |
0 |
options |
local(gdplist) |
parameters |
cty |
|
54 [+]
|
reshape
wide gdp
, i(date) j(cty) string
|
55 [+]
|
describe
All properties
key |
content |
command |
describe |
indent |
0 |
parameters |
|
|
56 [+]
|
foreach
c of local gdplist {
All properties
key |
content |
command |
foreach |
indent |
0 |
parameters |
c of local gdplist { |
|
57 [+]
|
local
allcty "`allcty' gdp`c'"
|
58 [+]
|
}
All properties
key |
content |
command |
} |
indent |
0 |
parameters |
|
|
60 [+]
|
foreach
c of local allcty {
All properties
key |
content |
command |
foreach |
indent |
0 |
parameters |
c of local allcty { |
|
61 [+]
|
local
allbut: list allcty - c
All properties
key |
content |
command |
local |
indent |
1 |
parameters |
allbut: list allcty - c |
|
62 [+]
|
qui
regress
`c' `allbut' date
All properties
key |
content |
command |
regress |
indent |
1 |
parameters |
`c' `allbut' date |
prefix |
qui |
|
63 [+]
|
display
_newline "Dependent variable `c':"
|
64 [+]
|
mat
list e(b)
All properties
key |
content |
command |
mat |
indent |
1 |
parameters |
list e(b) |
|
65 [+]
|
}
All properties
key |
content |
command |
} |
indent |
0 |
parameters |
|
|
98 [+]
|
local
date `c(current_date)'
|
99 [+]
|
local
time `c(current_time)'
|
100 [+]
|
local
vers `c(stata_version)'
|
101 [+]
|
local
mem `c(memory)'
All properties
key |
content |
command |
local |
indent |
0 |
parameters |
mem `c(memory)' |
|
102 [+]
|
local
flav = cond(`c(MP)', "MP", cond(`c(SE)', "SE", "IC"))
-
local flav = cond(`c(MP)', "MP", cond(`c(SE)', "SE", "IC"))
|
103 [+]
|
local
cwd `c(pwd)'
All properties
key |
content |
command |
local |
indent |
0 |
parameters |
cwd `c(pwd)' |
|
105 [+]
|
display
_newline "Run `date' at `time' on Stata/`flav' version `vers', memory = `mem' bytes"
|
106 [+]
|
display
_newline "Current working directory: `cwd'"
|
108 [+]
|
sysuse
auto
, clear
All properties
key |
content |
command |
sysuse |
indent |
0 |
options |
clear |
parameters |
auto |
|
109 [+]
|
display
_newline "Datafile: `c(filename)' (N=`c(N)', k=`c(k)') as of `c(filedate)'"
|