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 on April 23, and its replacement, is already up and running.

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

AW: st: Addressing variables

From   "Christopher Garlich" <>
To   <>
Subject   AW: st: Addressing variables
Date   Wed, 14 Sep 2011 16:08:35 +0200

Dear Robson,

Thanks for your reply.
I have tried that already and it just returns: "ambiguous abbreviation". I
also tried it with a macro, namely:
Local i i
And when I then try "avg = rowmean(Lag1 - Lag`i')", STATA actually
interprets it as lag"i", but not with value of variable i.
So my problem persists, I'm not able to address the value of i.  


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Robson
Gesendet: Mittwoch, 14. September 2011 13:43
Betreff: Re: st: Addressing variables

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-

On Wed, Sep 14, 2011 at 7:20 AM, Christopher Garlich
<> 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
> correctly?
> Thanks and regards,
> Chris
> *
> *   For searches and help try:
> *
> *
> *

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

*   For searches and help try:

*   For searches and help try:

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