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

From |
Kenley Barrett <k-barrett@northwestern.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Re: trickier subscript question |

Date |
Thu, 01 Apr 2004 18:36:50 -0600 |

Thank you for your help. Do you have any advice on where I could read up about macros?

At 07:00 PM 4/1/2004 -0500, you wrote:

i is a local macro (and must be referreed to as `i' when used in expressions) , not a variable and you want j to be the same (after all, they have nothing to do with observations, they are just counters). local j=`i'-1 It would be worthwhile to read up about macros if you want to program effectively or write complicated loops. Michael Blasnik michael.blasnik@verizon.net ----- Original Message ----- From: "Kenley Barrett" <k-barrett@northwestern.edu> To: <statalist@hsphsun2.harvard.edu> Sent: Thursday, April 01, 2004 6:48 PM Subject: st: trickier subscript question > Thank you to everyone for your replies. Now I need to do something tricky > with my looping: I need to refer to b1_0X and b1_0(X-1) in the same > command. Something like this: > > forvalues i = 1(1)9 { > gen j = i - 1 > gen newvar = b1_0`i' - b1_0`j' > } > > Unfortunately, Stata doesn't recognize i as a variable. Any suggestions? > Thanks so much to everyone for your help. > > Best, > Kenley > * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Re: trickier subscript question***From:*Richard Williams <Richard.A.Williams.5@nd.edu>

**References**:**st: trickier subscript question***From:*Kenley Barrett <k-barrett@northwestern.edu>

**st: Re: trickier subscript question***From:*"Michael Blasnik" <michael.blasnik@verizon.net>

- Prev by Date:
**st: Re: trickier subscript question** - Next by Date:
**st: RE: marginal effects and interactions** - Previous by thread:
**st: Re: trickier subscript question** - Next by thread:
**Re: st: Re: trickier subscript question** - Index(es):

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