Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: rearranging multiple date variables

From   Nick Cox <>
Subject   Re: st: rearranging multiple date variables
Date   Tue, 31 Jan 2012 01:26:09 +0000

-reshape long- and -drop- and -reshape wide- again.


On Mon, Jan 30, 2012 at 10:44 PM, Romana Pylypchuk
<> wrote:

> I have a dataset of hospital admissions (multiple per patient) which is in a wide format.
> The variables are:
> unique patient's identifier,  date of hospital admission 1, date of hospital discharge 1, date of hospital admission 2, date of hosp. discharge 2 , date of hosp. admission 3, date of hosp discharge. 3 and so on.
> I would need to combine into one each two visits that have discharge and subsequent admission on the same date.  Ie, if the date of hospital discharge 1 and hospital admission 2 is the same than date of hospital discharge 2 becomes date of hospital discharge 1, while all subsequent dates shift to the left (date of admission 3 becomes date of admission 2 and date of discharge 3 becomes  date of discharge 2).
> Is there a way to do this efficiently?

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index