Monday, December 12, 2011

Tips - Stata: a few useful ado-related commands

Tips - Stata: the handy Stata command/function
  • 'statsby', 'tabstat', 'scalar themean=r(mean)'.
  • 'contrast'(How to get orthogonal polynomial coefficient), 'pwmean', 'pwcompare', and 'margins'.
    • p. and q. of 'Contrast' (Orthogonal polynomials) allow to partition the effects of a factor variable into linear, quadratic, cubic, and higher-order polynomial components (I like to use p., q. assumes having equal space between groups). They are only meaningful with factor variables that have a natural ordering in the levels. For exmaple: .contrast p(2 3 4).bmigrp, noeffects
    • User defined contrast of race(3 levels) and age (2 levels) without comparing the middle race group: .contrast {race#age -1 -1 0 0 1 1}
  • 'destring', 'tostring','string()': Convdrting between numeric variable and string/character variable.
  • 'duplicate': Report, tag, or drop duplicate observations.
  • 'postfile' posts results in Stata dataset.
  • ... [Contents of Stata Help]

No comments: