I couldn't find anything on this in the help or manuals. It has been my experience, to the extent I've noticed, that if I issue a command using a varlist with a wildcard, e.g. -regress y x*-, Stata expands the varlist x* to a list of individual variables, and it preserves the order in which those variables appear in the data set.
I was in the process of writing a short program that takes a list of variables as arguments, but the first two variables in the list are treated differently in the program from the rest. Would I be safe in calling that program with a sequence like -myprogram x*- when the variable order in the data set puts the intended first two variables first? Or do I have to be more explicit: -myprogram x_first x_second ...- even if x_first and x_second are the first two such variables in the data?
I've experimented a bit with this, and so far * seems to reliably expand in the order they appear in the data set. But can I count on this in my programming?
I was in the process of writing a short program that takes a list of variables as arguments, but the first two variables in the list are treated differently in the program from the rest. Would I be safe in calling that program with a sequence like -myprogram x*- when the variable order in the data set puts the intended first two variables first? Or do I have to be more explicit: -myprogram x_first x_second ...- even if x_first and x_second are the first two such variables in the data?
I've experimented a bit with this, and so far * seems to reliably expand in the order they appear in the data set. But can I count on this in my programming?
Comment