Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: reshaping + info from label


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reshaping + info from label
Date   Tue, 25 Oct 2011 01:10:01 +0100

You don't show what you tried with -reshape-. If these were string
variables, then you can go

input date str1 variable1ab  str1 variable2cd
.  1      q                         w
.  2      e                         r
end
reshape long variable, i(date) string
l

     +-----------------------+
     | date    _j   variable |
     |-----------------------|
  1. |    1   1ab          q |
  2. |    1   2cd          w |
  3. |    2   1ab          e |
  4. |    2   2cd          r |
     +-----------------------+

I don't follow what you are trying to explain about labels. Value
labels? Variable labels? Nor do I follow what the connection with -ds-
or -findname- (SJ) is here.

Nick

On Tue, Oct 25, 2011 at 12:11 AM, Abhimanyu Arora
<abhimanyu.arora1987@gmail.com> wrote:

> I am trying to reshape data that has the following form---
>
> date variable1ab   variable2cd
> 1      q                         w
> 2      e                         r
>
>
>
> Assume the variable variable1ab is labelled A B, while variable2cd is
> labelled C D (actually strings, though)
>
>
> Finally I would like the data to be of the following form
>
> date var1 var2 value
> 1      A    B      q
> 2      A    B      e
> 1      C    D      w
> 2      C    D      r
>
>
> I feel the solution might lie in the commands -ds- or Nick Cox's
> -findname- together with -reshape- but I am just unable to see how.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index