Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Differencing a varlist


From   Dani Tilley <tilleydani@yahoo.com>
To   stata <statalist@hsphsun2.harvard.edu>
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index