Statalist The Stata Listserver

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

st: Combining two data files and follow-up data in

From   "Rosy Reynolds" <>
To   "statalist" <>
Subject   st: Combining two data files and follow-up data in
Date   Sat, 1 Jul 2006 11:20:39 +0100

Type -help reshape- to find out about the -reshape- command.
At the moment you probably have a variable called something like 'month' and
another one called something like 'alive'.
After you -reshape wide- you will have several variables with names like
'alive6', 'alive12' and so on.
You may need to use the -string- option if you have text (like Y and N)
instead of numbers in your 'alive' variable.
Be prepared to experiment a bit if you are new to -reshape-. The examples in
the help file will point you in the right direction.

Rosy Reynolds
Date: Fri, 30 Jun 2006 12:19:51 -0700 (PDT)
From: Ashwin Ananthakrishnan <>
Subject: Re: st: RE: Combining two data files and follow-up data in Stata


Thanks for getting back to me. I apologize if I'm
asking an obvious question but how do I reshape the
file from long to wide? Would you be able to explain
it further?

For example,

my main file has


My follow up file has

Case1      - 6 months - alive (Y)
Case1      - 12 months - alive (Y)
Case1      - 18 months - alive (N)

How do I reshape the follow up file so that it reads
             6 months          12 months     18months
Case 1           y                   y            n


- --- Richard Atkins <> wrote:

You will have to reshape your followup file from
long to wide (so each
case is a main_ID and has variables x_1, x_2 etc
representing the
repeated measurements.  They use the merge command.

Richard Atkins.
London School of Hygiene and Tropical Medicine

* For searches and help try:

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