Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Differencing a varlist

From   Dani Tilley <>
To   stata <>
Subject   st: Differencing a varlist
Date   Tue, 10 Aug 2010 09:54:56 -0700 (PDT)


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 

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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index