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

RE: st: Restructuring & merging multi-level data


From   Steven_A Harvey <[email protected]>
To   [email protected]
Subject   RE: st: Restructuring & merging multi-level data
Date   Sat, 18 Oct 2003 13:13:14 -0400

Dear Statalisters,

A few days back, I posted a question about restructuring multilevel 
data.  Nick Cox suggested I send the data structure rather than the 
narrative explanation I originally posted.  For some reason, when I 
sent the message below, the original message was posted instead.  My 
apologies for the repetition, but here is the response to Nick's 
request for clarification.  The original message & response appears 
below.  Again, many thanks in advance for your suggestions.

Steve Harvey

----------------------------------------------------------

My data is structured as follows.  I'm putting the varnames in a column 
here rather than a row because of the number of vars. involved.

prov#_id is each individual provider's id number.  

prov#_lab, prov#_del, prov#_m, prov#_nn are all dummy variables 
indicating, respectively, whether each provider participated in labor 
monitoring, delivery, post partum care for the mother, and post partum 
care for the neonate.

obs_no (numeric 1-n)
[demographic var list]
prov1_id (numeric)
prov1_lab (0, 1)
prov1_del (0, 1)
prov1_m (0, 1)
prov1_nn (0, 1)
prov2_id (numeric)
prov2_lab (0, 1)
prov2_del (0, 1)
prov2_m (0, 1)
prov2_nn (0, 1)
  .
  .
  .
prov8_id (numeric)
prov8_lab (0, 1)
prov8_del (0, 1)
prov8_pm (0, 1)
prov8_pnn (0, 1)
[explanatory varlist]


I've used reshape in other situations.  I don't think it will work here 
because I need to include the demographic and explanatory variables in 
each observation, but generate multiple observations per case (woman 
delivering) so that each observation contains information about only 
one provider.

I hope this explanation is more clear.  Thanks again for your 
suggestions.

Steve

---------------------------------



Date: Wed, 15 Oct 2003 18:04:58 +0100
From: "Nick Cox" <[email protected]>
Subject: st: RE: Restructuring & merging multi-level data


Steven A. Harvey, MHS, PhD(c)


> I am attempting a multi-level analysis of data on the
> performance of
> skilled birth attendants at managing labor and delivery in
> 4 countries.  My
> data set on performance is structured with the case (i.e.,
> the woman
> delivering) as the unit of analysis.  For each case, I have up to 8
> variables to record the ID numbers of providers who
> participated (i.e., up
> to 8 providers might have participated in some phase of any
> given case).  I
> also have 4 dummy variables indicating in which of 4 stages
> of labor &
> delivery each provider participated.
>
> My explanatory variables are collected at the provider
> level.  In these
> datasets, I have an individual provider ID # plus
> information about the
> provider's experience, scores on tests, perspectives on the
> quality of the
> health facility in which he/she works, etc.
>
> I need some mechanism in Stata that will help me reorganize
> the first
> dataset so that I have one record for each time a provider
> participated in
> a case (provider x case).  Then I want to match this with
> the explanatory
> variables based on provider ID#, presumably using Stata's
> merge command.
>
> Other than reorganizing the data by hand, I am at a
> complete loss about how
> to approach this.  I would greatly appreciate any suggestions.
>


It is usually much easier to understand a problem
from an example of data than from a verbal description.


My reading of this, however, is that you need a -reshape-
to long, followed as you say by a -merge-. You may well
need some renaming of variables before you can -reshape-.


Check out [R] reshape and also various extras at
http://www.stata.com/support/faqs/data/reshape3.html


Nick
[email protected]

*
*   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/



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