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/