Date: Thu, 13 Apr 2006 16:53:33 -0400
Reply-To: Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject: Re: Code for higher order neighbor generation
On Thu, 13 Apr 2006 15:55:59 -0400, Imam Xierali <imamx8@GMAIL.COM> wrote:
>Some of you ask about my code for second order neighbor generation in SAS. I
>am here pasting it to the email itself, the code works, though it can be
>improved. The direct connectivity dataset is from www.correlatesofwar.org.
...
Hi, Imam,
Thanks for sharing your code. I am a bit puzzled by its length and
complexity. Maybe you are doing way more than you say what you are doing.
Because finding out the "second order neighbors," given a list of the "first
order neighbors" can be as simple as below. Or am I missing something?
Cheers,
Chang
data neighbors;
input from to;
cards;
1 2
1 3
2 4
2 5
3 7
4 8
;
run;
proc sql;
title "second order neighbors";
select a.from, a.to as through, b.to
from neighbors as a, neighbors as b
where a.to = b.from
order by a.from, b.to
;
quit;
title;
/* on lst
second order neighbors
from through to
----------------------------
1 2 4
1 2 5
1 3 7
2 4 8
*/
|