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

st: not sure about my loop results

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


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,
*   For searches and help try:

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