Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: more informative names of dummy vars

From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: more informative names of dummy vars
Date   Tue, 10 Dec 2002 12:27:34 +0000

At 11:13 10/12/02 +0100, Annelies Vos wrote:
Hi all,
I'm using: -xi: poisson patient i.origin- and so on.
Origin refers to country of origin of the patients and is coded 1,2,..10
and each value is labeled like "Morocco", "Somalia" etc.
Now, when I perform -poisson- (or any other command using -xi-) I get
estimates for:
_Iorigin_1, _Iorigin_2 etc. Instead, I would like to get something like:
_Imorocco, _Isomalia etc. or _Iori_moroc, _Iori_somal etc. that would
make the outcomes readable...

Does anyone know whether it is possible to name the dummies depending on
the labels of the values of the variable they refer to?
One simple possibility is to use the -rename- command; see the manual under -[R] rename-. Annelies might type

xi i.origin
for X in numlist 1(1)10) \ Y in any morocco somalia britain holland usa belgium china ecuador venezuela uzbekistan:rename _Iorigin_X _Iori_Y
poisson patient _Iori*

This uses the -for- command to do a lot of repeats; see -help for- or the manuals under -[R] for-.

A slightly more advanced way might involve the use of the -parmest-, -descsave- and -factext- packages. A tutorial on the use of these is available at the Stata User Meetings website at

However, the simple way will do what Annelies wants.

I hope this helps.


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]

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

* For searches and help try:

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