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: Data Management Loop
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Data Management Loop
Date
Fri, 1 Apr 2011 19:35:21 +0100
I think the main question is not how to get this, but how and why do
you imagine it will help you?
For each type, the information is already accessible. Why repeat it?
Nick
On Fri, Apr 1, 2011 at 7:14 PM, Toby <[email protected]> wrote:
> Hello Statalist,
>
> i have a problem with the following data structure:
>
> id type x
> 1 1 1
> 2 2 2
> 3 1 3
> 4 2 4
> 5 1 5
> 6 2 6
>
> Now I want to generate additional variables that include the x value
> for the opposite type, so that the data looks like this:
>
> id type x x_2 x_4 x_6 x_1 x_3 x_5
> 1 1 1 2 4 6
> 2 2 2 . . . 1 3 5
> 3 1 3 2 4 6
> 4 2 4 . . . 1 3 5
> 5 1 5 2 4 6
> 6 2 6 . . . 1 3 5
>
> Until know I only have created a loop that generates this additional
> variables, but I did not figured out how to disriminate between the
> two type. Can anyone hive me a hint?
>
> Kind regards,
> Toby.
> *
> * 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/
>
*
* 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/