Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Problem with stcompet with by variable

From   "Nick Cox" <>
To   <>
Subject   st: RE: Problem with stcompet with by variable
Date   Thu, 3 Aug 2006 21:54:18 +0100

This is simple. Well, perhaps not, but here goes. 

-levels7- is a  user-written command for Stata 7 required to run 

-stcompet- has been published twice, once in the Stata Journal 
and later on SSC. 

If you downloaded the package from the Stata Journal website, the 
documentation there does tell you to install -levels7- (and 
also -bothlist-). (Type -search stcompet- to see this.) 

If you downloaded the package from SSC using -ssc-, the -levels7- files
(and the -bothlist- files) should be installed automatically. 

So why do you have the -stcompet- files but not the -levels7- file? My 
guess is that you used a browser to install the -stcompet- files
but did not complete the job. Whether this is so, be advised that 
-ssc- is always a better method than using a browser directly. I 
speak with some bias here, but the advice really is good. 

You need to do one of three things. 

(a) Install -levels7- by re-installing the package -stcompet- 
from SSC by 

. ssc inst stcompet, replace

(b) As you are using an up-to-date Stata 8.2, you can 
fix the problem by editing -stcompet.ado- and changing 
the call to 


to one to 


That is, just one word in the program needs changing. 

(c) If you were using Stata 9, you could fix the problem 
as in (b), or you could change the call to 


to one to


The history was this: 

0. A -vallist- command was written by me and published 
in STB-60. (A more up-to-date version of this is on 
SSC and maintained by Patrick Joly.) 

1. I rewrote -vallist- for Stata 7, and called it 
-levels-. This was then put on SSC. 

2. I then rewrote -levels- for Stata 8, but left 
the previous version as -levels7- for the benefit
of those still on Stata 7. Enzo Coviello used 
-levels7-, presumably because he himself was using 
Stata 7 when he first wrote -stcompet-. May Boggess, 
then of StataCorp, also contributed to his project. 

3. I then prevailed on StataCorp to adopt -levels- 
as an official Stata command during the lifetime 
of Stata 8. 

4. StataCorp had second thoughts about the name, 
as being one too good to waste on a small utility, 
and renamed it -levelsof- in Stata 9. 

As Gershon Scholem once said, "Nonsense is always
nonsense, but the history of nonsense is scholarship". 


P.S. Don't forget about -bothlist-. That lurks in 
a dusty package of mine called -listutils- on SSC. 
One-third of that package was made obsolete by 
-forval- and -foreach-, and another third was made
obsolete by -macrolists-, but some Stata programmers
used some of its programs in their programs, as in this case. 

Rachel Pearce
> I have a problem with stcompet when I include a "by" 
> variable; I get an error:
> unrecognized command:  levels7
> r(199);
> This occurs even when I run the example
> --- begin included dialogue ---
> . gen treat = _n>5000
> . replace t25 = -1/.25 * log(1-uniform())
> (10000 real changes made)
> . replace t99 = -1/.495 * log(1-uniform()) in 5000/l
> (5001 real changes made)
> . replace time = min(t99,t25)
> (6851 real changes made)
> . replace fail = (t25<t99) + 2*(t25>=t99)
> (6542 real changes made)
> . replace fail = 0 if time>=2
> (1567 real changes made)
> . replace time = 2 if time>2
> (1567 real changes made)
> . stset time, f(fail==1) noshow
>      failure event:  fail == 1
> obs. time interval:  (0, time]
>  exit on or before:  failure
> --------------------------------------------------------------
> ----------------
>     10000  total obs.
>         0  exclusions
> --------------------------------------------------------------
> ----------------
>     10000  obs. remaining, representing
>      2160  failures in single record/single failure data
>  8983.392  total analysis time at risk, at risk from t =         0
>                              earliest observed entry t =         0
>                                   last observed exit t =         2
> . stcompet Newci=ci,compet1(2) by(treat)
> unrecognized command:  levels7
> r(199);
> --- end included dialogue ---
> As you can see all previous commands in the do-file execute
> successfully and correctly. I can find no reference in the
> documentation to "levels7".
> Does anyone know what might be the problem here?
> I am running Stata9/SE 0.2 in Windows XP Home Edition SP2

*   For searches and help try:

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