Bookmark and Share

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


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

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


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: r(110) error with -svy-, -mark-, -marksample-
Date   Tue, 31 Jul 2012 17:19:23 -0500

The most obvious explanation is that you do have that __000003
variable present in your data set, for some strange reason (the data
set was saved while -tempvar- was created, but before it was cleaned
with an exit from a program). Sometimes, I do get something like that
with a complicated set of nested routines and some complicated
patterns of who creates and who cleans the -tempvar-s, although I
would expect that Stata would try to come up with the next available
-tempvar- name upon having checked that a variable already exists in
the data set. The conflict like that may also arise if you
deliberately drop a tempvar rather than let Stata do it. But it would
be strange if this error were in the official code.

On Tue, Jul 31, 2012 at 4:59 PM,  <[email protected]> wrote:
> 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 <[email protected]>
> 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/



-- 
---- Stas Kolenikov
-- http://stas.kolenikov.name
---- Senior Survey Statistician, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index