Infrequently asked questions
Some of the things I do with Stata are so rare that I always forget how I'd done them before. So, they turn into questions and they're infrequent.
1. Turn a string variable into more variables, one for each word of the longest string:
split mystringvar, gen(stub)
2. Collect the levels of a categorical string variable into a list:
levelsof mycatvar, local(levels)
3. Check that two lists are logically identical (same items, not necessarily in the same order):
local foo: list clean thislist
local bar: list clean thatlist
local test: list foo===bar // `test' returns either 0 or 1
Notice the three equal signs. That's not a typo. Two equal signs check for strict identity (i.e., the order of the items in the two lists matters).
You care to add to the list?