Bookmark and Share

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

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

AW: st: Problem with xi (Stata 11)

From   "Martin Weiss" <>
To   <>
Subject   AW: st: Problem with xi (Stata 11)
Date   Wed, 2 Jun 2010 15:05:50 +0200


" Stata 11 users are encouraged officially to use factor variables"

Walter may have a point, though, if all he wants is to use -xi- as a
standalone command, to generate dummies for a categorical variable. -tab,
gen()- may be an alternative.


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Roger Newson
Gesendet: Mittwoch, 2. Juni 2010 15:01
Betreff: Re: st: Problem with xi (Stata 11)

I don't know what exactly is going on in your case. However, I do know 
that Stata 11 users are encouraged officially to use factor variables 
instead of -xi-, although -xi- should still work (and has done so for me 
so far).

Best wishes


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 02/06/2010 13:47, Walter Garcia-Fontes 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
> To reproduce:
> webuse set
> 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:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index