Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Differencing a varlist
From
Dani Tilley <[email protected]>
To
stata <[email protected]>
Subject
st: Differencing a varlist
Date
Tue, 10 Aug 2010 09:54:56 -0700 (PDT)
Hi,
I'm writing a command that will expect a regressand and possibly several
regressors. At the beginning of the command, I do this to separate the
regressand from the regressors:
token `varlist'
local lefths `1'
mac shift
local righths `*'
So, if a user types -command y x1 x2- varlist will have y, x1 and x2, lefths
will have the first element of the varlist, y, and righths will have the rest,
x1 and x2. I can later easily say -reg `lefths' `righths'- if I want a simple
regression.
This has worked fine for me until now, when I need to regress the `lefths' on
the first difference of all the variables in `righths'. I tried, -reg `lefths'
D1.`righths'- but if righths has more than one variable, only the first is
differenced and the rest are ignored. Is there a way around this?
Thanks in advance,
DF Tilley
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/