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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Problem with xi (Stata 11)


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem with xi (Stata 11)
Date   Wed, 2 Jun 2010 08:02:05 -0500

I cannot replicate the problem:

. webuse set http://puna.upf.edu
(prefix now "http://puna.upf.edu";)

. webuse data/data.dta,clear

. xi i.COUNTRY
i.COUNTRY         _ICOUNTRY_40-380    (naturally coded; _ICOUNTRY_40 omitted)
.
. levelsof C, local(levels)
40 56 203 208 233 246 250 276 300 348 372 380

. local B = 40

. local levels: list levels - B
.
. foreach l of local levels {
  2.         assert  C == `l' &  _ICOUNTRY_`l' == 1 if C == `l'
  3. }


Scott

On Wed, Jun 2, 2010 at 7:47 AM, Walter Garcia-Fontes
<walter.garcia@upf.edu> wrote:
> I have a problem with the "xi" command in Stata 11 (completely updated
> as of today). I tried to create a dataset as simple as possible to
> reproduce the problem, which can be accessed from my server. In the
> dataset there is a single variable called COUNTRY with numeric codes
> for each country and labels identifying the country.
>
> There are 12 different values for COUNTRY (12 different countries) and
> 79155 observations with a variable number of observations for each country.
> To reproduce:
>
> webuse set http://puna.upf.edu
> webuse data/data.dta
> xi i.COUNTRY
>
> Stata creates variables _ICOUNTRY_n as it should, where n are the
> different codes for the 12 countries, omitting the country with the
> smallest code.
>
> The problem is that some of the values of _ICOUNTRY are 0 when they
> shouldn't be, for instance I have cases where _ICOUNTRY_56 = 0 but
> COUNTRY = 56. This happens randomly for a few cases and I've looked at
> it from all angles but couldn't figure out what is going on.
>
> If I reduce the number of variables or the number of observations the
> problem  disappears at some point, can't tell exactly when, so I'm
> providing the smallest example I could build.
>
> Walter
>

*
*   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