Nick
I did want to look at positions 1 and 2, 3 and 4 etc. etc., and Mark
Holmes solution worked fine.
Sorry for not closing the thread.
Neil
> Neil Shephard asked
>
> > I have a load of genotype data for a whole genome screen and
> > simply want to test each locus for Hardy-Weinberg equilibrium
> > using the -genhw- command. Since there are 370 markers I
> > thought I'd use the following to achieve this...
> >
> > tokenize d*
> > while "`1'" ~= ""{
> > genhw `1' `2'
> > mac shift 2
> > }
> >
> > However upon execution I'm told that
> >
> > too many variables specified
> > r(103)
> >
> > genhw works fine if I type in the variable names, but this is very
> > repetative (boring and time consuming).
> >
> > Can anyone suggest why this might be happening.
> >
>
> and G. Mark Holmes answered
>
> > If you tokenize d* you will get "d*" in `1' (literally). That is,
> tokenize
> > will not exapnd varlists.
>
> > One solution:
>
> > unabbrev d*
> > tokenize $S_1
> > while "`1'" ~= ""{
> > genhw `1' `2'
> > mac shift 2
> > }
>
> The code here looks at variables with positions within -d*-
> 1 and 2, 3 and 4, 5 and 6, etc. Is that what is
> desired?
>
> Nick
> [email protected]
>
>
> *
> * 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/
Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]
"Contrariwise, if it was so, it might be; and if it
were so it would be; but as it isn't, it ain't. That's
logic" - Tweedledee (Alice Through the Looking Glass)
*
* 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/