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

From |
"Nichols, Austin" <ANichols@ui.urban.org> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: data manipulation/reduction |

Date |
Fri, 27 Aug 2004 14:42:48 -0400 |

My guess is that if you can pose the question more clearly, you will almost have written the Stata code yourself. In your example, it's not clear which vars you've generated, and which are given, and there is no indication what wound~er measures, and percent does not seem to measure any percent in the data as given. Assuming you want the number of non-missing values of wound~er by name, by approach, by machine, you would -egen AdverseEvents=count(wound~er), by(name machine approach)- and then suppose the number of bites at the apple is given by surger~s in one obs per (name machine approach) cell, so you would -egen NEvents=max(surger~s), by(name machine approach)- and then -gen AdverseRate=AdverseEvents/NEvents- and -bysort name machine approach: drop if _n>1- to get one obs per cell. -----Original Message----- From: Clint Thompson [mailto:Clint.Thompson@hsc.utah.edu] Sent: Friday, August 27, 2004 2:23 PM To: statalist@hsphsun2.harvard.edu Subject: st: data manipulation/reduction Hello All --- I am using Intercooled, v.8.2. I was presented w/ an Excel file wherein I need to generate rates of an adverse outcome relative to the number of procedures. Toward that end, I was given the number of surgeries for each clinician and the number of adverse outcomes for each clinician. Computing crude rates was not problematic, however, I now need to stratify by surgical approach & type of machine. My primary problem is that I'm struggling with how to reduce the data from an essentially 'long' form to 'wide' form. An abbreviated example of the data as received is as follows: +-----------------------------------------------------------------+ | name surger~s technqe total percent wound~er approach | |-----------------------------------------------------------------| | John Doe 750 100 100 25 . | | John Doe . . . 75 5 divide | | John Doe . . . . . divide | | John Doe . . . . . divide | | John Doe . . . . . divide | | John Doe . . . . . divide | +-----------------------------------------------------------------+ where 'surger~s' denotes # of procedures for the respective clinician and 'wound~er' denotes the number of adverse events for that clinician. There are about a half-dozen 'approaches' and about a half-dozen machine types (variable not shown) wherein I'd like to compute rates. Note that there are 100 unique clinicians but many of the clinicians occupy multiple lines because they reported 2 or more adverse events. Any suggestions? I've struggled w/ this for a while and haven't had any success using the help file or Stata-list archives... 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/

- Prev by Date:
**st: data manipulation/reduction** - Next by Date:
**st: destringing values led to Stata recoding them as missing** - Previous by thread:
**st: data manipulation/reduction** - Next by thread:
**st: destringing values led to Stata recoding them as missing** - Index(es):

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