Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: r(110) error with -svy-, -mark-, -marksample-


From   <S.Jenkins@lse.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: r(110) error with -svy-, -mark-, -marksample-
Date   Tue, 31 Jul 2012 22:59:55 +0100

I am unable to run some -svy- related commands using one of my data
sets. The puzzle is that I have no problems with similar commands
applied to data from the Ref Manuals (cf. example below: uses
"stage5a.dta").

The issue: after -svyset-,  -svy: ...- commands produce a r(110) error

[P]     error . . . . . . . . . . . . . . . . . . . . . . . .  Return
code 110
        __________ already defined;
        A variable or a value label has already been defined, and you
        attempted to redefine it.  This occurs most often with generate.

But I had made no such attempt to redefine, as far as I know. With -set
trace on-, it seems that the command applied to my data is choking when
it makes a call to -marksample-. There's an example below: uses
"voldat.dta".

In another example (not shown), I had been using -idonepsu- (command to
deal with singleton PSUs; on SSC), and also hit the same error, though
this time with a call to -mark- according to a -set trace on-.  [Even
more strangely (to me), I have a log file from a job also using
-idonepsu and same data set, dated 6 Jul 2012, that ran without error.]

Any ideas? 

Stata 12MP/4, fully updated. Behaviour observed on Win7/64bit and Win
XP/32bit
. display "`c(tmpdir)'"
C:\DOCUME~1\stephen\LOCALS~1\Temp/

2 examples follow:
======= works ok with data from the Ref Manuals
. clear all

. webuse stage5a

. svyset su1 , strata(strata)

      pweight: <none>
          VCE: linearized
  Single unit: missing
     Strata 1: strata
         SU 1: su1
        FPC 1: <zero>

. svy: mean x1
(running mean on estimation sample)

Survey: Mean estimation

Number of strata =       3          Number of obs    =   11039
Number of PSUs   =       9          Population size  =   11039
                                    Design df        =       6

--------------------------------------------------------------
             |             Linearized
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
          x1 |  -.0072936   .0059146     -.0217661    .0071789
--------------------------------------------------------------

======= does not work ok with my data 

. use voldat

. de psu strata age12

              storage  display     value
variable name   type   format      label      variable label
------------------------------------------------------------------------
----------------------------------------
psu             int    %8.0g       rpsu       primary sampling unit
strata          int    %8.0g       rstrata    stratification class
age12           byte   %8.0g       rage12     age at 1.12.2008

. su psu strata age12

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
         psu |     98010    130.2724    70.35036          1        411
      strata |     98010    36.03071    21.96916          1        103
       age12 |     98010    38.25698    11.27417         17         59

. svyset psu, strata(strata)

      pweight: <none>
          VCE: linearized
  Single unit: missing
     Strata 1: strata
         SU 1: psu
        FPC 1: <zero>

. svy: mean age12
(running mean on estimation sample)
__000003 already defined
r(110);

. set trace on 

. svy: mean age12

< ... snip ... >

      - marksample touse, novarlist `zero'
      = marksample touse, novarlist zeroweight
__000003 already defined
 
------------------------------------------------------------------------
-- end _svy_summarize.Estimate ---
      ereturn local cmdline `"`cmdline'"'
      }
 
------------------------------------------------------------------------
------------- end _svy_summarize ---
    ereturn local cmdline `"svy `cmdline'"'
    exit
    }
 
------------------------------------------------------------------------
------------------- end svy.SvyEst ---
------------------------------------------------------------------------
---------------------------- end svy ---
r(110);


Stephen
-------------------------------------
Professor Stephen P. Jenkins <s.jenkins@lse.ac.uk>
Department of Social Policy 
London School of Economics and Political Science
Houghton Street, London WC2A 2AE, U.K.
Tel: +44 (0)20 7955 6527
Changing Fortunes: Income Mobility and Poverty Dynamics in Britain, OUP
2011, http://ukcatalogue.oup.com/product/9780199226436.do
Survival Analysis using Stata:
http://www.iser.essex.ac.uk/survival-analysis  
Downloadable papers and software: http://ideas.repec.org/e/pje7.html 



Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index