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

Re: st: xpose command


From   Philippe Glaziou <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: xpose command
Date   Tue, 4 Mar 2003 08:20:19 +0700

Don Spady <[email protected]> wrote:
> I am having trouble transposing some data.  I do not think this
> is a reshape problem.  Below are the original data as imported
> from Excel using StatTransfer.

I think that you should not jump too fast on you mouse and click
StatTransfer. Your data needs to be prepared a little bit, for
stata to read it properly.

I do not know much about excel --only that I keep reminding
researchers in my institution that excel is one of the worst
possible choices of tools to enter data. However, I suppose that
excel has a transpose command of some sort. You should transpose
your block of cells within excel before attempting an export,
because the logics of stata is that rows represent observations.

By the way, you mail client is configured in a poor way to
display tables. My suggestion and advice is that you select a
fixed-width font rather than whatever else.



>  c1          c2   c3     c4     c5     c6     c7
> Treat      0       0          1       1       2           2
> Sample  1       2        1       2        1           2
> Na      7.9     7.8     7.2     8.3     16.4     16.4
> K      21.4     20.6     19.1 20.7     19.1     19
> cl      13.4     12.6     12.6 11.6     13     13
> ca      8.6       8.3       8.8     8.8    6.2     6.3
> 
> 
> .xpose, clear varname
> I get this in the editor
> 
>     v1    v2    v3   v4   v5         v6 _varname c1
>                                                         c1
>     0        1     7.9   21.4   13.4    8.6 c2
>     0        2     7.8   20.6   12.6    8.3 c3
>     1        1     7.2    19.1  12.6    8.8 c4
>     1        2      8.3   20.7   11.6    8.8 c5
>     2        1      16.4 19.1    13      6.2 c6
>    2         2      16.4 19       13       6.3 c7
> I have lost the values of the first variable (the na k cl etc)


My guess is that StatTransfer figured that stata would prefer the
data without the first column rather than with it, because all
your variables would have to be of the string storage type, which
stata does not like too much. 

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