Bookmark and Share

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: Addressing variables


From   Robson Glasscock <[email protected]>
To   [email protected]
Subject   Re: st: Addressing variables
Date   Wed, 14 Sep 2011 07:42:39 -0400

I think you need to reference Lag"i" using Lag`i'

With an extra space it looks like this:

` i '

That referencing has worked for me in conjunction with the -levelsof- command.

On Wed, Sep 14, 2011 at 7:20 AM, Christopher Garlich
<[email protected]> wrote:
>
> Hi everybody,
>
> I have a dataset with lag-variables, e.g. Lag1 - Lag5. I want to take the
> mean of Lag-variables 1-"i", where "i" is a number defined in another
> variable, e.g. a variable called "i".
> So I'm trying to do something like this:
> egen avg = rowmean(Lag1 - Lag"i")
>
> but I cannot get it to work. Does somebody know how to address variable "i"
> correctly?
>
>
> Thanks and regards,
> Chris
>
>
> *
> *   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/



--
Robson Glasscock, CPA
Accounting PhD Student
Virginia Commonwealth University
Snead Hall, B3132
P.O. Box 844000
Richmond, VA 23284

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index