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

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:22:01 +0100 |

Sacrificial Sacrificial Sorry - forgot the truncated line problem I have an analysis where I need to compare a set of repeat measurements to a known standard value and then visualise the data in a stripplot with the standard value as a reference line, and this is repeated over several different systems and each system has a different standard value. Eventually there will be in excess of 100 systems. 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/

**Follow-Ups**:**Re: st: Re: Loop programming***From:*Jeph Herrin <junk@spandrel.net>

**st: RE: Re: Loop programming***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: Re: Loop programming** - Next by Date:
**st: tsset with non-integers** - Previous by thread:
**st: Re: Loop programming** - Next by thread:
**st: RE: Re: Loop programming** - Index(es):

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