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

st: Re: bug in xpose.ado?


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: bug in xpose.ado?
Date   Wed, 6 Nov 2002 17:21:19 -0600

----- Original Message -----
From: "Patrick Joly" <[email protected]>
To: <[email protected]>
Sent: Wednesday, November 06, 2002 1:39 PM
Subject: st: bug in xpose.ado?


> -xpose- seems to object when the _varname variable contains the
> string values v1, v2, ..., vN.  For instance,
>
> clear
> set type double
> set obs 10
> g str1 _varname = ""
> replace _varname = "v" + string(_n)
> g myvar = _n
>
> . list
>      _varname      myvar
> 1.         v1          1
> 2.         v2          2
> 3.         v3          3
> 4.         v4          4
> 5.         v5          5
> 6.         v6          6
> 7.         v7          7
> 8.         v8          8
> 9.         v9          9
> 10.       v10         10
>
> (the actual values of myvar are irrelevant, as long as myvar is a
> numerical variable)
>
> . xpose, clear
> v1 already defined
> r(110);
>
> However, v1 appears only once within _varname.  The only restriction on
> the values of _varname is that they must be 'legal' names (right?) and
> v1 is a perfectly legal name.
>
Perhaps the problem is not the values of the variable but the variable name.

If you rename _varname xpose seems to work.

. clear
. set type double
. set obs 10
obs was 0, now 10
. g str1 _varname = ""
(10 missing values generated)
. replace _varname = "v" + string(_n)
_varname was str1 now str3
(10 real changes made)
. g myvar = _n

. renpfix _v v
. xpose, clear
. list

             v1          v2          v3          v4          v5          v6
v7          v8          v9         v10
  1.          .           .           .           .           .           .
.           .           .           .
  2.          1           2           3           4           5           6
7           8           9          10


Scott



*
*   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