Skip to content

Common pitfalls

Aaditya Dar edited this page Jul 22, 2019 · 7 revisions
  • build

  • 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:
gen newvar = string(var1,"%02.0f") + string(var2, "%03.0f")
assert length(newvar ) == 5