Bookmark and Share

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]

st: Generate new variable after using long to wide transformation


From   "Helen Gibbs" <[email protected]>
To   <[email protected]>
Subject   st: Generate new variable after using long to wide transformation
Date   Wed, 14 Jul 2010 12:07:06 +0100

First of all, thanks for the initial help received to get me started. I am
really beginning to see why I was told I needed to learn STATA over
SPSS...another convert here.

My next question is slightly less foolish I think!

I have a large epidemiological database of twin variables, and I now need to
look at the differences between pairs of twins, and generate more variables
which are differences e.g. weight_dif = (weight of twin_1) - (weight of
twin_2)

So far, I have managed to use the wide to long variable transformation so I
now have two variables called twin_number1 and twin_number2 in place of my
original variable twin_number.

Now I want to calculate the difference between the weight (and about another
376 variables) for each twin pair.

Can someone give me the syntax string for this? I am sure it is probably
quite simple, but after 3 hours of reading on the subject I am not getting
anywhere!

Bear in mind, that if the twin pair are in rows 2 & 3, the weights are in
rows 2 and 3, so I am needing to do a calculation which shows the difference
between twin 1 minus twin 2, that is then made into a positive interger for
the difference, whenever the difference is negative (as we are not
interested in the direction of the difference as the assignment of twin_1
and twin_2 is entirely a matter of circumstance.)

I hope I have explained this clearly, if not and you think you might be able
to help, you can send me a direct email to ask additional questions at
kiwihelen(at)gmail.com

Thanks in advance

Helen



T

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