Bookmark and Share

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: Using the "collapse" command to generate median and range


From   Sarah Sorscher <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Using the "collapse" command to generate median and range
Date   Thu, 15 Nov 2012 11:30:36 -0600

Dear list,

I am using the "collapse" command to generate summary statistics for my data. The following code gives me median, mean, standard deviation, and number (n) for my variable, *duration*, aggregated by *treatment* and *sickestpt*.

. collapse (p50) mediandur=duration (mean) meandur= duration (sd) sddur=duration (count) n=duration, by(treatment sickestpt)

But I can't figure out how to generate a range.

I haven't been able to find range in the Summary Statistics section of the STATA help manual, and searches churn up too many unrelated uses of the term "range."

I considered adding the following: 
(p99) hirangedur=duration (p1) lorangedur=duration

But this would only get me the 99th and 1st percentile, as opposed to range. 

Is there any term I could use to collapse for range?

Sarah


*
*   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/


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