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

st: RE: Re: Re: Multiple paired ttests

From   "Nick Cox" <>
To   <>
Subject   st: RE: Re: Re: Multiple paired ttests
Date   Thu, 9 Sep 2004 10:38:05 +0100

Let's assume optimistically that the wildcard *mm 
includes all the variables you want on one side. 
You could do this: 

foreach m of var *mm { 
	local f = substr("`m'",1,length("`m'")-1) + "f" 
	ttest `m' == `f' 

The first line in the loop could also be 

	local f = reverse(substr(reverse("`m'"),2,.)) + "f" 

but that's a bit of a backwards solution. You might 
also consider 

	local f : subinstr local m "mm" "mf" 

but that is more dangerous. 

The multiple comparisons issue of firing a shotgun 
in this way I leave on one side. 


Kaaresen Per Ivar
> However, I now realize I was inaccurate in describing my variable
> names.In fact they are named
> dimm atmm comm.......  and dimf atmf comf.......
> and I want to cycle through
> ttest dimm==dimf
> ttest atmm==atmf
> and so forth. Sorry for this. Any ideas?

*   For searches and help try:

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