Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: lowest value in a series of variables in wide data

From   Harrison Alter <>
Subject   st: lowest value in a series of variables in wide data
Date   Tue, 28 May 2013 07:44:11 -0700

I have a dataset of hospital stay records in which each row is a
subject, and many of the columns are time stamps, each varname
beginning with "los_", e.g. "los_admfloor" or "los_dcsdu". These are
doubles using -clock-.

To calculate the absolute length of stay, I want to generate a
variable, say, "timein" with the earliest time stamp, and one
"timeout" with the last, then subtract "timein" from "timeout".

To generate these variables in Stata 11.2 on a Mac, I tried:

 egen timein = min(los*), by ( patientid)

which returns

los* invalid name

What's the best way to identify the minimum value among the variables
beginning with "los"?

Thanks fo any advice you can provide.

Harrison Alter
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index