I apologize,
The program works fine now, maybe some problems copying ` and ' characters.
Thank you so much (to you and Marteen) for the help and the insight in the matter.
Diego
----- Messaggio originale -----
Da: n j cox <[email protected]>
A: [email protected]
Inviato: Domenica 21 ottobre 2007, 15:14:53
Oggetto: Re: st: cycling paired t test (and signed rank sum test)
Diego uses double quotes " " in defining his arrays.
As mentioned recently, in
<http://www.stata.com/statalist/archive/2007-10/msg00307.html>,
" " are not cosmetic but bind tighter than spaces separate.
Thus to Stata, "a1 b1 c1" is all _one_ word, or token. Thus, first time
around the loop, Diego is trying to execute
ttest a1 b1 c1 = a2 b2 c2
which is illegal.
The semi-colons don't perform any distinctive function
here, and, unless Diego is using Stata 6 or earlier, he is
better off with -forval-. So, Diego's code could be rewritten as
local array1 a1 b1 c1
local array2 a2 b2 c2
local n : word count `array1'
forval i = 1/`n' {
local var1 : word �i' of �array1'
local var2 : word �i' of �array2'
ttest `var1' = `var2'
}
Nick
[email protected]
Diego Bellavia
[...] I tried to implement arrays, and I ended up with something like
#delimit ;
local array1 "a1 b1 c1";
local array2 "a2 b2 c2";
local i = 1 ;
local n : word count `array1' ;
while `i' <= `n' {;
local var1 : word �i' of �array1';
local var2 : word �i' of �array2';
ttest `var1' = `var2';
local i = `i' + 1;
};
#delimit cr
but when i run it I get an "invalid syntax" error...I cannot understand
why.
*
* 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/
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html
*
* 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/