Thanks for all the suggestions.
Here are my codes:
egen x_temp=count(x_exp) if x_exp==-2, by(hhid)
sort hhid
drop if hhid==hhid[_n-1]
count if x_temp~=.
I got different number for the count command when repeating the above codes.
When I change the codes to "sort hhid x_temp", I get stable result.
Does this work the same way as the stable option? The previous results
are generally smaller than that after the change.
However, I'm still not clear how the stable option may affect my
result, since given the way x_temp is generated, it is the same for
all the observations with the same hhid. BTW, I have other variables
the values of which may be different among observations with the same
hhid.
Thank you.
Best,
Luhang
On 6/20/05, Richard Williams <[email protected]> wrote:
> At 08:45 PM 6/20/2005 -0400, Luhang Wang wrote:
> >Hi to all,
> >
> >I have some question regarding the use of sort. Would anyone tell me
> >some potential reasons for getting different results by running
> >
> >sort id
> >drop if id==id[_n-1]
>
> Also, you might want to look at the -duplicates drop- command.
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> FAX: (574)288-4373
> HOME: (574)289-5227
> EMAIL: [email protected]
> WWW (personal): http://www.nd.edu/~rwilliam
> WWW (department): http://www.nd.edu/~soc
>
> *
> * 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/