Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: xtile2 error <<-Now ok


From   Xavi Barber <xbarber@altern.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: xtile2 error <<-Now ok
Date   Mon, 05 Apr 2004 15:53:11 +0200

Thanks Richard Williams

The new xtile2 is:

*! 1.0.1 ZWang 1Jun1999
program define xtile2
version 7
_parsewt "aw fw pw" `0'
local 0  "`s(newcmd)'"
local wt "`s(weight)'"
syntax newvarname =exp [if] [in], by(varlist) /*
    */ [Nquantiles(string) ALTdef ]
token "`0'", pars(" =")
tempvar x touse group tile
mark `touse' `wt' `if' `in'
markout `touse' `by'
qui gen double `x' `exp' if `touse'
qui egen `group'= group(`by') if `touse'
qui sum `group'
local ngr=r(max)
/*if "`nquantiles'"!=""{local nq "n(`nquantiles')"}*/
/*  Change this line Stata7 to Stata8*/
if "`nquantiles'"!=""{
   local nq "n(`nquantiles')"
}
local i=1
qui {
  gen `1'=.
  while `i'<=`ngr'{
        xtile `tile'=`x' `wt' if `group'==`i', `nq' `altdef'
        replace `1'=`tile' if `group'==`i'
        drop `tile'
    local i=`i'+1
  }
}

end


At 15:41 05/04/2004, you wrote:
At 03:20 PM 4/5/2004 +0200, Xavi Barber wrote:
Dear statalisters:

        I use a xtile2 command:
                xtile2 ttt=lnkcal  if edad3c<998, nq(4) by(sexo1 edad3c)

        bur stata say:
                program error:  matching close brace not found

        Can You help me?
The program is missing a version command, and as a result syntax changes in Stata 8 screw it up. Edit xtile2.ado and add the following immediately after the program define line:

version 7

Either that, or change this line to be Stata 8 compliant:

if "`nquantiles'"!=""{local nq "n(`nquantiles')"}

I think you change it to

if "`nquantiles'"!=""{
local nq "n(`nquantiles')"
}

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index