Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: median


From   "philippe van kerm" <[email protected]>
To   <[email protected]>
Subject   st: RE: median
Date   Fri, 11 Aug 2006 15:54:33 +0200

>
>I'd like to calculate how many observations in each cohort are above
the total median value of a variable. Does anyone know if there is an
easy way to do that without having to calculate the median first and
include the value in each following calculation? I couldn't find
anything in the help files. Thank you
>

It is difficult to answer without information about how your data are
set up. I doubt there is any one-line command to do that. But it seems
like a straightforward operation, however:

summarize X , detail
gen abovemedian = X > r(p50)  if !missing(X)
tab COHORT abovemedian

(assuming X is your variable about which you compute the median and
COHORT is a categorical variable indicating to which cohort an
observation belongs to)

Philippe

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept 
**********************************************************************



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index