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]
Re: st: Differencing a varlist
From
Dani Tilley <[email protected]>
To
[email protected]
Subject
Re: st: Differencing a varlist
Date
Tue, 10 Aug 2010 10:24:17 -0700 (PDT)
Hi Maarten,
Thanks for distracting me from my problem. It turns out that saying -reg
`lefths' D1.(`righths')- solves the issue. I only thought of trying this after
seeing your comment in parentheses. Strange, but thanks.
Dani
----- Original Message ----
This may not be an answer to your question, but I usually do
that operation in one line:
gettoken y x : varlist
(I like y and x for lefths and righths, but I guess that is
my personal aversion against typing...)
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
From: Dani Tilley <[email protected]>
To: stata <[email protected]>
Sent: Tue, August 10, 2010 12:54:56 PM
Subject: st: Differencing a varlist
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/
*
* 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/