-
Notifications
You must be signed in to change notification settings - Fork 6
Common pitfalls
Aaditya Dar edited this page Jul 22, 2019
·
7 revisions
-
build
- Not mapping the netCDF before extracting data from it
- Common Stata mistakes
- Top ten Stata gotchas
- using
encode
to define unique IDs in different datasets before merging them - not using
assert
to verify conditions as you prepare the data (especially useful right aftermerge
)
-
analysis
- watch out for the N: missing values in 'control' variables i.e. other than the outcome or primary predictor could cause the estimating sample to change
-
other tips (these aren't mistakes as such)
- not ensuring that unique IDs have a fixed length (pro tip: you can define new string variables which embed numeric codes with leading zeros
gen newvar = string(var1,"%02.0f") + string(var2, "%03.0f")
. here's an example of how you can use assert to verify that coded the new variable correctly:
- not ensuring that unique IDs have a fixed length (pro tip: you can define new string variables which embed numeric codes with leading zeros
gen newvar = string(var1,"%02.0f") + string(var2, "%03.0f")
assert length(newvar ) == 5
- Research and professional ethics
- Getting started
- Text editor
- Organization
- Stata
- Python
- GIS
- Git and GitHub
- LaTeX
- Workflow
- More