Friday, September 16, 2011

Tips: Stata - my first Stata program

capture program drop tabm
 program tabm
   version 12
   syntax varlist [if][in],cell count column row se ci ///

          cv percent proportion]
   local varnum : word count `varlist'
   local x : word 1 of `varlist'
   forvalues i=2/`varnum' {
       local y: word `i' of `varlist'
       svy: tabulate `x' `y',`col' `cell' `se' `percent' ///

            format(%5.1f)
  }
end


.tabm sex race5grp diabetes,cell se percent

No comments: