[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Jared Fotis" <kingjared@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns |

Date |
Sun, 17 Aug 2008 15:48:25 +0200 |

Eva, Thank you for the timely response on a sunday. Indeed that is but one line code for a long macro that i thought it better not to post in its entirety. You are correct that i have vars LHS_NMCE_1 through _10, however these variables are equal to 1 2 3 or 4 representing the group of that firm for that year, which can be continuously changing. Therefore, the ==5 and ==1 in the example are meant to be hard code as the 1 represents the associated group for that firm in the year before that firm exited (LHS_NMCE_* value in the previous `X' global loop) while the 5 signals the year after a group 1 firm disappears (replacing the blank LHS_NMCE_* for that specific `X' loop). This line of code is then repeated for groups 2 3 and 4 by replacing them with 6 7 and 8, respectively, in the first year after the firm exited. This is all done to see the rate at which firms from different groups drop out of the data by comparing the number of 5's in that year to the total number of 1's in the year before (while dropping out firms that have already exited, via a series of "save" and "use" commands in the macro, so that they are not double counted). As my question only pertains to the way in which you tell stata to use the value of the previous loop (or even just the variable with a name of that loop value minus 1, if forgetting about the values in the global helps), I thought it unnecessary to go into such detail. The reference to [_n-1], which refers to the value of the previous row, is that I am hoping there is an equal expression to instruct stata to refer to the previous value of the global loop it is then running. Does such a shortcut exists, and if not, has anyone found a solution in their own research? Best, Jared * * 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/

**Follow-Ups**:**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns***From:*"Eva Poen" <eva.poen@gmail.com>

**References**:**st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns***From:*"Jared Fotis" <kingjared@gmail.com>

**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns***From:*"Eva Poen" <eva.poen@gmail.com>

**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns***From:*"Eva Poen" <eva.poen@gmail.com>

- Prev by Date:
**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns** - Next by Date:
**Re: st: Issue with options in addplot and lpoly** - Previous by thread:
**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns** - Next by thread:
**Re: st: How to tell a macro to use previous global value of that loop, akin to [_n-1] for columns** - Index(es):

© Copyright 1996–2019 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |