As -help forvalues- shows, -forvalues- expects a -range- whereas you provide
it with "numsib"...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nirina F
Sent: Monday, December 08, 2008 1:23 PM
To: [email protected]
Subject: Re: st: RE: constructing sibling sex composition
Hi Martin,
I tried this:
egen boynum= count(sexsib*==1), by (hhid)
but of course sexsib* came out as invalid name.
I have variables sexsib1 , sexsib2, .... sexsib12. These are the sex
of the siblings and the siblings vary from 0 to 12 depending on the
number of siblings in the household.
But I have also numsib whcih tells me the number of siblings.
I guess I have to write a loop :
. forvalues t=numsib{
2. egen boynum= count(sexsib`t'==1), by(hhid)
3. }
but then I get " invalid syntax
r(198);" because I have an error in my code
Could you please let me know where I should correct?
Thank you
Nirina
On Mon, Dec 8, 2008 at 3:35 AM, Martin Weiss <[email protected]> wrote:
> Well, you wanted to -count- something, and -egen, count()- sounds like a
> good idea to me. It allows -by- as well, so you can count for each
family...
>
> HTH
> Martin
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Nirina F
> Sent: Monday, December 08, 2008 12:36 AM
> To: [email protected]
> Subject: Re: st: RE: constructing sibling sex composition
>
> Dear Martin,
> I looked but couldn't find which one would work for what I
> specifically would like to construct.
> Do you mind pointing it to me please?
>
> By the way, what do you mean: line for the server?
> Nirina
>
> On Sun, Dec 7, 2008 at 4:41 PM, Martin Weiss <[email protected]> wrote:
>>
>> Line for the server...
>>
>> This code would give you an indicator variable showing what the highest
>> value of "sex" is for each family. Provided that in the dummy "sex" the
>> females are coded as "1" (which in my experience is unusual), you can
take
>> this as a dummy for the presence of at least one female in the family. It
>> does not give you the number you asked for in the initial post, though...
>>
>> HTH
>> Martin
>>
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Nirina F
>> Sent: Sunday, December 07, 2008 10:35 PM
>> To: [email protected]
>> Subject: Re: st: RE: constructing sibling sex composition
>>
>> Thank you Martin,
>> you are for example pointing out to this code?
>>
>> -egen anyfem = max(sex), by(family) -
>>
>> Thakns,
>> Nirian
>>
>> On Sun, Dec 7, 2008 at 4:00 PM, Martin Weiss <[email protected]>
wrote:
>>>
>>> Line for the server...
>>>
>>> You may find the answer here: http://www.stata.com/support/faqs/data/
>>>
>>>
>>> HTH
>>> Martin
>>>
>>>
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of Nirina F
>>> Sent: Sunday, December 07, 2008 9:54 PM
>>> To: [email protected]
>>> Subject: st: constructing sibling sex composition
>>>
>>> Hello,
>>> I have a household survey data and would like to construct a variable
>>> that indicates the sex composition of the respondent's siblings.
>>>
>>> I have the year of birth and sex of siblings.
>>>
>>> Does anyone know how to do this because the number of siblings vary by
>>> respondent and the minimum number of sibling is 0 and maximum is 12.
>>>
>>> Thank you very much,
>>> Nirian
>>> *
>>> * 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/
>>>
>>> *
>>> * 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/
>>>
>> *
>> * 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/
>>
>> *
>> * 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/
>>
> *
> * 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/
>
> *
> * 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/
>
*
* 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/
*
* 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/