I would like to create a Stata program that takes multiple lists of unspecified length as arguments. However, I don't know how the program can distinguish between the lists once they're passed in.
For example, I'd like to be able to do something like:
prog myprog
args list1 list2
{something with list1}
{something with list2}
end
loc list1 a b c
loc list2 x y z
myprog `list1' `list2'
loc list1 a b c d
myprog `list1' `list2'
The two solutions I've been thinking about are:
- Creating additional macros specifying the length of each list and passing those in as well
- using a delimiter between lists
Neither is very difficult, but I would think there's a simpler way to do this.
I'm using Stata 13 for Windows.
The following works for me:
or: