Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Richard Goldstein <richgold@ix.netcom.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Using the "collapse" command to generate median and range |
Date | Thu, 15 Nov 2012 12:55:31 -0500 |
two of the options for the collapse stats are the "min" and the "max"; the difference is the range Rich On 11/15/12 12:30 PM, Sarah Sorscher wrote: > 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/