Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Summarize without Min and Max


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Summarize without Min and Max
Date   Thu, 12 Sep 2002 09:37:57 -0400

Here's one quick solution, which just wraps its own display routine
around -summarize-:

prog define mysum
	version 7
	syntax varlist

	di
	di "{txt}{ralign 12:Variable} {c |}" _c
	di "{ralign 8:Obs}{ralign 12:Mean}{ralign 12:Std. Dev.}"
	di "{hline 13}{c +}{hline 32}"	
	foreach var of local varlist {
		qui sum `var'
		local vname = abbrev("`var'",12)
		di "{txt}{ralign 12:`vname'} {c |}{res}" _c
		di %8.0f `r(N)' "   " _c
		di %9.0g `r(mean)' "  " _c
		di %9.0g `r(sd)'
	}

end

--Nick Winter

-----------------------------------------------------------
 Nicholas Winter, Ph.D.                     P 202.939.5343
 Policy Studies Associates                  F 202.939.5732
 1718 Connecticut Avenue, NW     nwinter@policystudies.com
 Washington, DC 20009-1148           www.policystudies.com
----------------------------------------------------------- 

> -----Original Message-----
> From: John GIBSON [mailto:jkgibson@mngt.waikato.ac.nz] 
> Sent: Thursday, September 12, 2002 9:21 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Summarize without Min and Max
> 
> 
> Dear Listers
> 
> I am working on confidential unit record files and my output 
> is not allowed to identify individual respondents. This 
> prevents using the "Summarize" command when I want means and 
> std deviations of my variables, because Max and Min are also 
> included and these refer to individual respondents.
> 
> While I can use Tabstat it is much less convenient because I 
> have to specify the varlist (and using _all fails because 
> there are string variables in the dataset).
> 
> Does anyone have a version of the Summarize command that 
> suppresses the Min and Max?
> 
> Thanks.
> 
> John Gibson
> 
> *
> *   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/
> 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index