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]

st: rearranging multiple date variables

From   Romana Pylypchuk <>
To   "''" <>
Subject   st: rearranging multiple date variables
Date   Mon, 30 Jan 2012 22:44:43 +0000

Dear Stata List Users,

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? 
Any help/suggestions will be appreciated. 

Kind regards
Romana Pylypchuk
University of Auckland 

*   For searches and help try:

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