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: lincom intolerant of the variable name "d"


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: lincom intolerant of the variable name "d"
Date   Mon, 28 Jun 2010 15:55:33 -0500

David Airey <[email protected]> has a factor variable named 'd' in
his analysis, and is getting a syntax error from -lincom- on a simple
difference between two levels of 'd':

> After use of anova and margins, I got this error:
> 
> 
> . test 1.d = 2.d
> 
>  ( 1)  1bn.d - 2.d = 0
> 
>            chi2(  1) =   18.46
>          Prob > chi2 =    0.0000
> 
> . lincom 1.d - 2.d
> d-2:  operator invalid
> r(198);
> 
> And then, changing the variable name "d" to "drug", I got this:
> 
> . test 1.drug = 2.drug
> 
>  ( 1)  1bn.drug - 2.drug = 0
> 
>            chi2(  1) =   18.46
>          Prob > chi2 =    0.0000
> 
> . lincom 1. drug - 2. drug
> 
>  ( 1)  1bn.drug - 2.drug = 0
> 
> ------------------------------------------------------------------------------
>              |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>          (1) |        1.8   .4189935     4.30   0.000     .9787878    2.621212
> ------------------------------------------------------------------------------
> 
> Why would the variable name "d" be a problem?

Stata is having a difficult time parsing

	1.d-2.d

because 'd' is one of those special letters (like 'e') that can be used in
specifying a numeric literal.  For example

	1.d-2

is a way to specify .01.

We have determined where the problem is, and believe we have a fix.  The fix
will be in a future executable update.

In the mean time David can use the 'i' operator, as in

	. lincom i1.d - 2.d

to help Stata parse his linear combination.

--Jeff
[email protected]
*
*   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