strpos

e.g.

replace borough = "Westminster" if borough == "" & strpos(postcode, "W1") == 1

strpos

e.g.

replace borough = "Westminster" if borough == "" & strpos(postcode, "W1") == 1

Advertisements

http://www.stata.com/help.cgi?lookfor

This will generate r(varlist), which can be used in loops. e.g.

foreach i in `r(varlist)'{

gen ln_`i’=log(`i’)

}

http://www.ats.ucla.edu/stat/stata/dae/zinb.htm

I got access to the NBS manufacturing census data. The data is so unclear… Now I am worried that I will be caught by bad regressions…

For example, there are so many zeros in the data. I do not know this is because (1) they are really 0, (2) the firms did not report or (3) the real value is very small so that the firm ignored it…There are some ways to deal with these issues such as ZINB. However, these maximum likelihood methods are not so great for fixed-effects models as simple OLS.

http://www.stata.com/support/faqs/data/pairs.html

I find this is particularly useful for career data.

another trick from stata to excel.

e.g.

estpost sum var1, de

esttab using forfun.csv, cells(“mean sd”) replace scsv