Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: tabout and foreach -counter error

From   "Claudia Y. Rangel" <>
Subject   st: tabout and foreach -counter error
Date   Wed, 7 Dec 2011 01:00:15 -0500


I am trying to replicate the example in Dr. Watson's tabout tutorial
to produce tables for 25 variables with restricted data, repeated over
30 geographical units; hoping to reduce my  lengthy do file code. I am
sure there is a problem with the special characters and after trying
to use (') (`) and (') I still got an error returned about the counter

My apologies for any stata 101 coding mistakes.

levelsof lipsname, local(levels)
local lipslabels : value label lipsname
local counter = 0
local filemethod = "replace"
local heading = ""

foreach 1 of local levels {
  if `counter' > 0 {
      local filemethod = ”append”
      local heading = ”h1(nil) h2(nil)”
  local vlabel : label ’lipslabels’ ’l’

qui tabout  var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11
var12 var13 var14 var15 var16 var17 immigrant if lipsflag==1  & if
lipsname == ’l’ using ”tablesfile.txt”, ’filemethod’ ///
cells (freq row)  show(all)  layout(cb) stats(chi2) ’heading’
h3(”LIPS: ’vlabel’”) f(0c) ptotal(single)
local counter = `counter' + 1

I appreciate any help,


*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index