Statalist


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

st: not sure about my loop results


From   "Nirina F" <[email protected]>
To   [email protected]
Subject   st: not sure about my loop results
Date   Sat, 20 Dec 2008 10:38:55 -0500

Hello,

I was writing the following loop to get the age of each of the
respondent's sibling.

local n=sibnum
forvalues i=1(1)`n'{
gen agesib`i'= 2006-yearsib`i' if yearsib`i' !=.
}

yearsib is the year of birth of the sibling and 2006 is the year of the survey.

if I -tabulate- sibnum, it varies from 0 to 11 at various frequencies.

However the results of the loop above give me:

agesib1, agesib2, ....till agesib5 only not until agesib11 which is
wierd to me.

I am not sure if I am getting this agesib for each respondent or just
the first respondent.
I have the unique individial identifier and other variables.

Could you please let me know if there is something wrong and how to correct it?

thank you very much,
Nirina
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index