## Help With Stata String Functions

Hi,

I'm attempting to create a piece of code that will generate a log file within a forvalues loop. The code should take a word from position "number" and insert it in the name of my log file. Except it doesn't work. Here's the pseudo code i'm using:

forvalues number = 1(1)3 { ;
gen str20 namenumber' = word("name1 name2 name3", number');
log using "C:" name`number' ".log", replace;

code within loop;

};

Anyone see the bug? I'm betting it's something simple but in all the different syntax combinations I’ve tried nothing seems to work. PLEASE HELP!