Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: how to make list of network ties from long data


From   Brendan Halpin <brendan.halpin@ul.ie>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: how to make list of network ties from long data
Date   Fri, 05 Oct 2012 23:36:59 +0100

On Fri, Oct 05 2012, Caleb Southworth wrote:

> I would like to make a list of people who are connected on some
> identical variable, such as publishing in the same journal.
>
> So I have . list date-magazine
>
>      +----------------------------+
>      | date   author     magazine |
>      |----------------------------|
>   1. | 1920    Woolf         Dial |
>   2. | 1921    Woolf      Mercury |
>   3. | 1930    Woolf       Nation |
>   4. | 1925    Joyce         Dial |
>   5. | 1930    Joyce   Transition |
>      |----------------------------|
>   6. | 1927        L         Dial |
>   7. | 1930        L   Transition |
>      +----------------------------+
>
> And the desired outcome would be:
>
> Woolf Joyce
> Woolf L
> Joyce Woolf
> Joyce L
> L Woolf
> L Joyce

input year2 str20 name2 str20 magazine
1920    Woolf         Dial
1921    Woolf      Mercury
1930    Woolf       Nation
1925    Joyce         Dial
1930    Joyce   Transition
1927        L         Dial
1930        L   Transition
end

sort magazine
save alter, replace

rename year2 year1
rename name2 name1

joinby magazine using alter

drop if name1==name2 & year1==year2
list


-- 
Brendan Halpin,   Department of Sociology,   University of Limerick,   Ireland
Tel: w +353-61-213147  f +353-61-202569  h +353-61-338562;  Room F1-009 x 3147
mailto:brendan.halpin@ul.ie    ULSociology on Facebook: http://on.fb.me/fjIK9t
http://teaching.sociology.ul.ie/bhalpin/wordpress         twitter:@ULSociology
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index