Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Dropping/Keeping observations


From   "Gauri Khanna" <[email protected]>
To   [email protected]
Subject   st: Dropping/Keeping observations
Date   Sat, 22 Apr 2006 12:29:57 +0000

It works... thanks Nick.

This leads to one more question.

I am subsampling my data out. I would like to KEEP those plots/observations where farmerID appears more than once. Hence, I would like to DROP those observations which have only one farmerID. Any tips?

I looked on the drop /keep command in Stata help and the examples given are rather simple.

Thanks again.

Regards,

Gauri



From: "Nick Cox" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: Producing averages for cross sectional data by ID
Date: Fri, 21 Apr 2006 18:56:55 +0100

Sorting by farmer ID is not necessary. You can
get the averages with a suitable -egen, mean()-
and -by()- or -by:-.

Nick
[email protected]

Gauri Khanna

> I would like to produces averages in my cross sectional data and was
> wondering how to do it.
>
> I have cross sectional data on 300 plots for 100 farmers.
> Each plot is
> associated with a farmer's identification. Hence the same
> farmer can have
> multiple plots.
>
> I would like to estimate the following production function for my 100
> farmers:
>
> (Yi-Yibar)=(X1i-X1ibar)+(X2i-X2ibar)+(X3i-X3ibar)+....
>
> where i= ith farmer, Y = output, and X1i,X2i...'s= various
> inputs of the ith
> farmer,
>
> Yibar=average output of ith farmer calculated over his multiple plots,
> X1ibar=average of input1 of ith farmer calculated over his
> multiple plots
> etc.
>
> How can I select the ith farmer from my data and calculate
> averages? Note
> that each farmer has a farmerID
>
> I know that I must sort the data by "farmerID" but what comes after?

*
*   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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

*
* 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/




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