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

st: RE: graph matrix bug


From   "Nick Cox" <[email protected]>
To   "Nick Cox" <[email protected]>, <[email protected]>
Subject   st: RE: graph matrix bug
Date   Fri, 21 May 2004 13:17:55 +0100

Further experimentation indicates 

1. Single upper-case letters as variable names 
can also be problematic even if the variable labels 
have been dropped. The logic is presumably 
that Stata wants to use the variable label if 
it exists and the variable name if it doesn't. 

2. A fix is to add a space to the end of the 
offending variable labels. In our case, the
dataset includes geochemical variables which are abundances of various 
elements in river water: we want variable names which are lower 
case for convenience in typing in Stata, but variable labels 
which are upper case for chemical correctness 
(boron is B and carbon is C, etc.), and we don't want
the full names for simplicity in the graph. So our boron 
has name -b-, variable label "B", etc. 

A recipe for adding spaces in our case is thus 

foreach v of var ? { 
	label var `v' "`:variable label `v'' "
} 

Nick 
[email protected] 

> -----Original Message-----
> From: Nick Cox 
> Sent: 21 May 2004 11:07
> To: '[email protected]'
> Subject: RE: graph matrix bug
> 
> 
> We had the same problem recently. Derek Wagner of StataCorp 
> sent me this: 
> 
> -----------------------------
> After testing the problem, it appears that -graph matrix- 
> doesn't like 
> a single upper-case letter as a variable label.  I have forwarded the 
> issue on to Vince, so hopefully there will be a change in the 
> next update.
> 
> In the meantime, you could graph your results by either 
> getting rid of the 
> variable labels (especially B, K, V, etc.) or change them to 
> lower-case.
> --------------------------- 
> 
> This seems consistent with what you did, as your copies 
> produced by -generate- are born without variable labels. 
> 
> Nick 
> [email protected] 
> 
> Andrzej Tomaszewski
>  
> > I found that graph matrix reports error when it is run with 
> > some variables  
> > (I have noticed it only with integer variables), and then all 
> > is working  
> > after generating new variable equal to the troublesome one 
> > (with the same  
> > or different data type).
> > I have reported the bug on the Stata Users Meeting in Berlin 
> > earlier this  
> > year and according to his answer I've sent an e-mail to Alan 
> > Riley at  
> > StataCorp, but I haven't got any answer to that one.
> > I hoped that it will be dealt with in the next large update, 
> > but in the  
> > update of 18 May 2004 (admittedly large and very useful for 
> me) the  
> > problem is persistent.
> > Please find below the code with use of exemplary dataset based on  
> > "Regression analysis by example" by S. Chatterjee, A.S. Hadi 
> > and B. Price.
> 
> > -
> > log:
> > 
> > . use http://www.wne.uw.edu.pl/tomaszewski/xy.dta, clear
> > 
> > . d y x1 x2
> > 
> >                storage  display     value
> > variable name   type   format      label      variable label
> > --------------------------------------------------------------
> > -----------------
> > y               int    %8.0g                  Y
> > x1              int    %8.0g                  X1
> > x2              int    %8.0g                  X2
> > 
> > . graph matrix y x1 x2
> > invalid syntax
> > invalid syntax
> > invalid syntax
> > r(198);
> > 
> > . gen int y1=y
> > 
> > . graph matrix y1 x1 x2
> > <beautiful graph - AT>
> > . gen float y2=y
> > 
> > . graph matrix y2 x1 x2
> > <again beautiful graph - AT>
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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