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]

From |
"Y.R.E. Retamal" <yrer2@cam.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: any idea? |

Date |
Sun, 15 Dec 2013 22:39:06 +0000 |

Dear Red Owl and Nick

Best wishes Rodrigo On 2013-12-14 22:31, Nick Cox wrote:

In addition to Red's helpful suggestions, note that technique for such paired data was discussed in http://www.stata-journal.com/sjpdf.html?articlenum=dm0043 which is publicly accessible. The problem is that the identifiers in Rodrigo's example appear to make little sense. How is Stata expected to know that 1 and 4, 2 and 5, 3 and 6 are paired? Perhaps the structure of the dataset is clearer in practice. If so, basic calculations are just a couple of lines or so. Nick njcoxstata@gmail.com On 14 December 2013 15:33, Red Owl <rh.redowl@liu.edu> wrote:Rodrigo, The following code demonstrates an approach with basic loops. It could be made more efficient with a different loop structure, but this approach may be more informative. *** BEGIN CODE *** * Build demo data set. clear * Length is capitalized to distinguish from length(). input id str5(side) Length 1 right 10 2 right 15 3 right 11 4 left 13 5 left 10 6 left 12 end gen byte newvar1 = . forval i = 1/3 { replace newvar1 = Length[`i'] - Length[4] in `i' } forval i = 4/6 { replace newvar1 = Length[`i'] - Length[1] in `i' } gen byte newvar2 = . forval i = 1/3 { replace newvar2 = Length[`i'] - Length[5] in `i' } forval i = 4/6 { replace newvar2 = Length[`i'] - Length[2] in `i' } gen byte newvar3 = . forval i = 1/3 { replace newvar3 = Length[`i'] - Length[6] in `i' } forval i = 4/6 { replace newvar3 = Length[`i'] - Length[3] in `i' } list, noobs sep(0) *** END CODE *** Good luck. Red Owl redowl@liu.eduY.R.E. Retamal" <yrer2@cam.ac.uk> Sat, 14 Dec 2013 12:08:42: Dear list I am very complicated trying to perform an analysis using STATA and Icannot find the way. Maybe you could help me. I want to create somenewvariables containing the difference between the length of two individuals from different groups:id side length newvar1 newvar2 newvar3 1 right x x-j x-k x-l 2 right y y-j y-k y-l 3 right z z-j z-k z-l 4 left j j-x j-y j-z 5 left k k-x k-y k-z 6 left l l-x l-y l-z I do not know if I do explain myself clearly, the individuals arebones (clavicles, for example), so it is possible that some right clavicles pair-match with left clavicles, following the idea that an individual has bone of similar length.Any help could bring me a light! Best wishes Rodrigo* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: any idea?***From:*Red Owl <rh.redowl@liu.edu>

**Re: st: any idea?***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**st: Estimates store after oaxaca eform** - Next by Date:
**st: Problem with GMM command** - Previous by thread:
**Re: st: any idea?** - Next by thread:
**st: fit index for ordered logistic regression** - Index(es):