[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Philip Ryan <philip.ryan@adelaide.edu.au> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: data set reconfiguration |

Date |
Sun, 9 Nov 2003 00:27:44 +1030 |

Clint It's a little hard to be sure exactly how to approach this most efficiently as your data all *appear* as strings, but of course may just be labels hiding numbers. In what follows I will assume that the outcome variables (q1_1 and q1_2) are in fact numeric - otherwise you won't be able to do a signed rank test - but if they are strings you had better first change them to numeric. I will however assume that the variable "eye" holding values "OD" and "OS" is string, only because this leads to a demonstration of a required extra option in the -reshape- command. (may one guess that "OD" signifies the right - dextra- eye, and "OS" the left - sinistra - eye??). Anyway, assuming that "None" for the outcome variables might really be a score of 0 in some, at least ordinal, scoring system: . list , nolabel +------------------------------------------+ | jmec_no eye iol q1_1 q1_2 sex | |------------------------------------------| 1. | 30332 OD SA60 0 0 F | 2. | 30332 OS AR40 0 0 F | 3. | 46199 OD SA60 0 0 F | 4. | 46199 OS AR40 0 0 F | +------------------------------------------+ then . reshape wide iol q1*, i(jmec_no) j(eye) string (note: j = OD OS) Data long -> wide ----------------------------------------------------------------------------- Number of obs. 4 -> 2 Number of variables 6 -> 8 j variable (2 values) eye -> (dropped) xij variables: iol -> iolOD iolOS q1_1 -> q1_1OD q1_1OS q1_2 -> q1_2OD q1_2OS ----------------------------------------------------------------------------- Note that: 1. I had to specify the -string- option, because the j index is ordinarily expected to be numeric. 2. I had to either drop the iol variable or (as I ended up choosing) include it in the list of variables I wanted reshaped, since iol is not constant within each case identifier. . list, nolabel +-------------------------------------------------------------------+ | jmec_no iolOD q1_1OD q1_2OD iolOS q1_1OS q1_2OS sex | |-------------------------------------------------------------------| 1. | 30332 SA60 0 0 AR40 0 0 F | 2. | 46199 SA60 0 0 AR40 0 0 F | +-------------------------------------------------------------------+ and, given some more data to make it sensible, one could: . signrank q1_1OD = q1_1OS to do a paired test on outcome q1_1 between eyes, and . signrank q1_2OD = q1_2OS to do the same on outcome q1_2 Phil Quoting cthompson@dfpm.utah.edu: > Greetings STATA-listers, > I have a dataset examining eye surgeries and I want to examine > how responses to certain variables (e.g. q1_1, q1_2, etc.) > between each eye vary. The problem is, my dataset is > structured as pasted below: > > +------------------------------------------+ > | jmec_no eye iol sex q1_1 q1_2 | > |------------------------------------------| > 1. | 30332 OD SA60 F None None | > 2. | 30332 OS AR40 F None None | > 3. | 46199 OD SA60 F None None | > 4. | 46199 OS AR40 F None None | > +------------------------------------------+ > > How do I restructure the dataset so that the Wilcoxon sign rank > test can be performed?? That is, I recognize that I need to > reshape it or create an array or do some manipulation, but I am > at a loss as how to proceed (even after a perusal of the > reference manual and STATA help feature) - any suggestions? > > Many thanks, > Clint Thompson > * > * 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/ > -- Philip Ryan Associate Professor Department of Public Health University of Adelaide 5005 South Australia AUSTRALIA CRICOS Provider Number 00123M ----------------------------------------------------------- This email message is intended only for the addressee(s) and contains information that may be confidential and/or copyright. If you are not the intended recipient please notify the sender by reply email and immediately delete this email. Use, disclosure or reproduction of this email by anyone other than the intended recipient(s) is strictly prohibited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient. * * 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/

**Follow-Ups**:**Re: st: data set reconfiguration***From:*cthompson@dfpm.utah.edu

**References**:**st: data set reconfiguration***From:*cthompson@dfpm.utah.edu

- Prev by Date:
**Re: st: Compare two datasets** - Next by Date:
**st: Re: X-Priority: 3 (Normal)** - Previous by thread:
**st: data set reconfiguration** - Next by thread:
**Re: st: data set reconfiguration** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |