st: "looping" within a command

For want of a better, term, I describe my question as how to loop inside a
single command. I don't see how to make foreach or forvalues work for
this kind of problem, nor has browsing the programming manual, the FAQs, or
Nick Cox's Stata Journal articles on lists turned up a solution.

The command uses the arguments x1...xN, and I would like to be able to
treat N as a variable. For instance, I need to read a fixed-format text
file which contains a number N of string variables; N varies each time I
run the program. The following infix statement does the job for N=5:

However, N varies from say 25 to 100 (the variables are answers on a
multiple choice test), so I would prefer to use some kind of structure
which allows me to set N once, and then build up each command without
typing the full list of arguments x1...xN.