Errata for An Introduction to Stata Programming

The errata for An Introduction to Stata Programming are provided below. Click here for an explanation of how to read an erratum. Click here to learn how to determine the printing number of a book.

(1) Chapter 3, p. 55, last example
forvalues i = 11/15 {
        rename v‘i’ = x ‘=1960 + ‘i’’
}
forvalues i = 11/15 {
        rename v‘i’ x‘=1960 + ‘i’’
}
(1) Chapter 4, p. 74, last Stata command on page
display "Analysis run by $USER from $BASEDIR at `c(current-date)' `c(current-time)'" display "Analysis run by $USER from $BASEDIR at `c(current_date)' `c(current_time)'"
(1) Chapter 5, p. 85, first Stata command
. assert NCPregnancy = 0 if gender == "Male" . assert NCPregnancy == 0 if gender == "Male"
(1) Chapter 7, p. 158, fifth command in example
. local ncty: word count country
. local ncty: word count `country' 
(1) Chapter 7, p. 158, second sentence of first paragraph
To extract those values on the right-hand side of the generate command, ... To extract those values on the right-hand side of the replace command, ...
(1) Chapter 8, p. 161, Stata command
local county Suffolk Norfolk Middlesex Worcester Hampden
local cseat Boston Dedham Cambridge Worcester Springfield
local wc 0
foreach c of local county {
       local ++wc
       local sn: word `wc' of `cseat'
       generate seatshare`county' = `sn' / `c'
}
local county Suffolk Norfolk Middlesex Worcester Hampden
local cseat Boston Dedham Cambridge Worcester Springfield
local wc 0
foreach c of local county {
       local ++wc
       local sn: word `wc' of `cseat'
       generate seatshare`c' = `sn' / `c'
}