[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Dear statalist,
If the ids are numeric, then
gen both = string(min(pupil, friend)) + " " + string(max(pupil, friend))
and if they are string, then
gen both = cond(pupil < friend, pupil, friend) + " " + cond(pupil < friend, friend, pupil)
Now search for -duplicates- on both.
Suppose "Tony" names "Gordon" as his best friend, and vice versa.
It is true that "Gordon" < "Tony" as inequalities with strings are
based on alphanumeric order.
will both be mapped to "24 42"
will both be mapped to "Gordon Tony". Then, as said, look for
Phillip Sinclair PhD (Lond) MSc BSc
> I have a data list of the following form:
> 1. pupil id ... friend id
> 2. pupil id ... friend id
> 3. etc
> Each pupil can have several friends, each listed as a
> separate case i.e. there can be several cases with the same
> pupil id each case identifying a separate friend.
> I wish to create a new variable to identify reciprocated
> friendship choices e.g. where pupil A names pupil B as a
> friend and pupil B names pupil A as a friend.
> Please can you tell me of a simple way of doing this in STATA.
* For searches and help try: