Dear All
I have a set of data where I need to replace a variable's content
depending if it is in a group and one of the variables contains a
certain value.
For example
a b c d e
101 1 01-May-06 Paper 1
101 1 01-May-06 Disc 0
101 1 01-May-06 Electronic 0
102 1 02-May-06 Paper 1
102 1 02-May-06 Disc 0
103 2 02-May-06 Disc 0
103 2 02-May-06 Electronic0
I know that the first three observations are in the same group (using
the egen command for variable a, b and c) and the second group is the
next two observations and so on but in each group if variable d contains
"Paper" then I want all the observations in the group for variable e
changed to a 1. If there is no "Paper" in the group then to leave as
they are.
So to end up with
a b c d e
101 1 01-May-06 Paper 1
101 2 01-May-06 Disc 1
101 3 01-May-06 Electronic 1
102 1 02-May-06 Paper 1
102 2 02-May-06 Disc 1
103 2 02-May-06 Disc 0
103 2 02-May-06 Electronic0
Cheers
Catrina
*
* 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/