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

RE: st: how to make xi dummies inherit labels

From   Roger Harbord <>
Subject   RE: st: how to make xi dummies inherit labels
Date   Thu, 03 Oct 2002 11:22:49 +0100

What I was really after in the end was similar to the output of e.g.
. xi: logistic y i.x
. reformat, eform

- but with the coefficients labelled using the value labels assigned to x.
-desmat- does achieve this, but I had a couple of different problems when I tried -desmat-:

1) It takes over 2 minutes to run the first univariable logistic regression with -desmat- on my data , when -xi- is seemingly instant. May be connected to the fact that my dataset has 1100 variables (and 2400 observations). Much quicker subsequently though, even run on different variables.

2) I can't see how to get -desmat- to exponentiate the coefficients (to give odds ratios with logistic regression) when used as a command prefix:

. desmat: logistic y i.x

gives the same output as:

. desmat: logit y i.x

- and there's no -eform- option as there is with -outreg- and -reformat-.

Also I think -reformat- or -outreg- give me more flexibility in deciding what I want in the output, so I don't need to do so much work on the output before I present it to my client, which is ultimately my aim.

In conclusion i'll probably use Nick's 'canned solution' for transferring value labels to variable labels of dummies, in combination with -reformat- or -outreg-. But maybe it would be nice if there was an option for -xi- to tell it to inherit the labels in this way. Put that on the wish list for Stata 8...

Roger Harbord
Department of Social Medicine, University of Bristol

--On 03 October 2002 09:33 +0100 Nick Cox <> wrote:

John Hendrickx

-desmat- will do this. Try -ssc describe desmat-
I tried -desmat- after my posting. I couldn't
see that it did quite this.


       log:  C:\Stata7\desmat.log
  log type:  text
 opened on:   3 Oct 2002, 09:30:21

. u auto
(1978 Automobile Data)

. desmat : regress mpg foreign
< snip >
nr Effect                                                     Coeff
1    Foreign                                                  4.946**
2  _cons                                                     19.827**
*  p < .05
** p < .01

. d _x_1

              storage  display     value
variable name   type   format      label      variable label
_x_1            byte   %8.0g                  foreign==1

. tab foreign

   Car type |      Freq.     Percent        Cum.
   Domestic |         52       70.27       70.27
    Foreign |         22       29.73      100.00
      Total |         74      100.00

That is, the variables created do not inherit value labels,
which I understood be what Roger wanted.


*   For searches and help try:

*   For searches and help try:

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