Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Loop programming


From   "Sherriff, Martyn" <martyn.sherriff@kcl.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Loop programming
Date   Thu, 7 May 2009 12:10:27 +0100

	I have used a simple forvalues loop for this, but my problem is how to get the standard values into the loop. My crude and inefficient solution is to add standard values to the dataset, calculate their mean value, and then use this as the reference.

set more off
forvalues i=1/7{
	di "`: label (sys) `i''"
	qui{
		su ts if sys==`i'
		local tsm=r(mean)
	}
	ttest m=`tsm' if sys==`i'
	stripplot m if sys==`i',over(bn) vert bar stack separate(set) title("`: label (sys) `i''") yline(`tsm')
	}
set more on

	Is there a straight forward method of getting these standard values into the loop? Eventually there will be in excess of 100 systems.

Many thanks,
Martyn
 

	




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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