Please ignore the earlier message; there was an error in the code.
Deepankar
On Thu, 2007-11-29 at 14:55 -0500, DEEPANKAR BASU wrote:
> I am working with survey data on Stata 8. In the dataset observations are by family and I have complete birth history for each family. I want to compute the sex ratio at birth for a chosen cohort.
>
>
>
> /*------ DETAILS OF SURVEY DESIGN---------*/
> gen strat = v022
> gen psuid = v021
> gen smpwt = v005/1000000
> svyset [pweight=smpwt], strata(strat) psu(psuid)
>
>
> /* yob1 gives the year of birth for child 1 */
> /* yob2 gives the year of birth for child 2 */
> /* ------------------------------------ */
> /* yob18 gives the year of birth for child 18 */
>
> /* - CREATING THE BIRTH COHORT: 1995-20 - */
> gen id = _n
> reshape long yob, i(id) j(birth)
> drop if yob<1995
> drop if yob>2000
> reshape wide
>
> /* ---------------------------------------- */
> /* GETTING SEX OF CHILD: MALE=1; FEMALE=0 */
> /* sxch1 gives the sex of child 1; and so on... */
> forval i=1/18 {
> quietly gen sxch`i'= cord`i'-2 if cord`i'==2
> quietly replace sxch`i'= cord`i' if cord`i'==1
> }
>
>
> reshape long sxch, i(id) j(birth)
> svymean sxch
>
> I get the error message "no observations" after the last command. What am I missing?
>
> Thanks.
>
> Deepankar
>
> *
> * 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/