Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: subscripts for loop?

From   Nomoreno <[email protected]>
To   [email protected]
Subject   Re: st: subscripts for loop?
Date   Wed, 31 Mar 2004 19:34:34 -0500

Maybe you can try this. First set a local variable by "local i=1", then use b0_`i' to refer to each variable. If you set i as a global one by "global i=1", then you do use bo_$i to refer to it.

I hope it helps.

[email protected] wrote:

I'm stumped on a programming problem. I need to refer to a sequence of variables b0_01, b0_02, b0_03 . . . b0_18, where the subscript identifies an individual child of a given
woman and the first part of the variable refers to some characteristic of
that child. (The woman is the unit of observation, and for each woman
there are up to 18 children observed.) My idea was to do a loop with j=1,
then j = j+1, etc., referring to b0_j. But this won't work. My boyfriend
suggested doing the j loop and then concatenating to b0_, but I can't
find anything in stata on how to concatenate a number to a string.
Does anyone have any ideas?

Thanks for your help!

* For searches and help try:

*   For searches and help try:

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