Tumur Gunchinmaa <mailto:[email protected]> wrote at
Monday, February 07, 2005 12:09 PM:
> Dear all,
> I would appreciate if you could give me some advice on the following
>
> I had a data on market participation of households. The number of
> times each household participates in the different markets varies
> between the households. When I have reshape the data into a long
> format the data became as follows:
>
> ...
>
> So from the sample, household 1 traded only one time and
> household 2 traded twice. What I would like to is hence household
> 1 traded only once, I need to delete the second set of observations
> for this household making no changes to the observations of
> household 2.
>
> I have tried to do various options, but they did not work. I would
> appreciate any help.
>
Does this help?
. gen trades = real(substr(market,2,2))
. bys ID trades (price): keep if price[_N] == "x"
-Ben
*
* 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/