Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: data manipulation/reduction

From   "Nichols, Austin" <>
To   "''" <>
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 []
Sent: Friday, August 27, 2004 2:23 PM
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:

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