On Sun, 2 Jun 2019, Fred Engst wrote:
I noticed a line of code that I didn’t know was possible from your
response earlier:
"ols lwage 0 log(wage) —simple”
Here you’ve invoked a function on the command line, i.e. log(wage),
not a existing series’ name. Other transformation is also possible,
such as ols y 0 y(-1 to 4) that I’ve noticed. This raises a question
about the nature of the indepvars in the ols documentation. What
other command line transformation that is possible without creating
a new variable first?
The argument passed to ols and related commands is a list (of series)
and a list can only contain named series (members of the dataset, with
ID numbers). So you can employ any function that returns a list, or
that creates a named series. This includes
log, lags, diff, ldiff, sdiff, square, dummify, cdummify, dropcoll
You cannot, for example, do
ols y 0 x^3
because "x^3" just gives an anonymous result, that must be assigned a
name and ID number before it can feature in a list.
This isn't documented as such; it probably should be. But for each of
the relevant functions it's documented that they either return a list
or create an automatically named series.
Allin