Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[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 <[email protected]>
To
[email protected]
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:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/