<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880287#M347806</link>
    <description>&lt;P&gt;These network (graph) statistics are now available from PROC OPTGRAPH, for which you need the SAS Network Algorithms license.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procgralg/procgralg_optgraph_details01.htm" target="_self"&gt;the procedure documentation&lt;/A&gt;, you only need a &lt;EM&gt;links&lt;/EM&gt; (i.e. from-to pairs) dataset to get it going.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The centrality statistics are requested with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procgralg/procgralg_optgraph_syntax04.htm" target="_self"&gt;CENTRALITY statement&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 20:16:22 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2023-06-12T20:16:22Z</dc:date>
    <item>
      <title>converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880038#M347690</link>
      <description>&lt;P&gt;My data is a list of edges (links) of a social network. It has only two columns: the first represents the focus node ID and the second represents the target node ID. The order, however, is not important, as the network is undirected. The link repetition is not important as the network should be binary.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can&amp;nbsp;I create the adjacency matrix for an undirected network with elements equal to 1 if there is any number of links between node pairs, and zero otherwise?&lt;/P&gt;&lt;P&gt;(ultimately, I want to calculate the node centralities.)&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 02:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880038#M347690</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-11T02:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880042#M347692</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
You want this ?
If you have SAS/OR, the code could be more compact and less.
*/
data have;
infile cards ;
input from $  to $ ;
cards;
1     2
1     3
4     5
5     2
9     4
6     7
8     7
;
run;
data full;
  set have end=last;
  if _n_ eq 1 then do;
   declare hash h();
    h.definekey('node');
     h.definedata('node');
     h.definedone();
  end;
  output;
  node=from; h.replace();
  from=to; to=node;
  output;
  node=from; h.replace();
  if last then h.output(dataset:'node');
  drop node;
run;


data want(keep=node household);
declare hash ha(ordered:'a');
declare hiter hi('ha');
ha.definekey('count');
ha.definedata('last');
ha.definedone();
declare hash _ha(hashexp: 20);
_ha.definekey('key');
_ha.definedone();

if 0 then set full;
declare hash from_to(dataset:'full(where=(from is not missing and to is not missing))',hashexp:20,multidata:'y');
 from_to.definekey('from');
 from_to.definedata('to');
 from_to.definedone();

if 0 then set node;
declare hash no(dataset:'node');
declare hiter hi_no('no');
 no.definekey('node');
 no.definedata('node');
 no.definedone();
 

do while(hi_no.next()=0);
 household+1; output;
 count=1;
 key=node;_ha.add();
 last=node;ha.add();
 rc=hi.first();
 do while(rc=0);
   from=last;rx=from_to.find();
   do while(rx=0);
     key=to;ry=_ha.check();
      if ry ne 0 then do;
       node=to;output;rr=no.remove(key:node);
       key=to;_ha.add();
       count+1;
       last=to;ha.add();
      end;
      rx=from_to.find_next();
   end;
   rc=hi.next();
end;
ha.clear();_ha.clear();
end;
stop;
run;


proc sql;
create table want2 as
select x.*,coalesce(y.v,0) as v
from 
(select * from (select distinct node as node1 from want),(select distinct node as node2 from want)) as x
natural left join
(select a.node as node1,b.node as node2,1 as v from want as a,want as b where a.household=b.household and a.node ne b.node) as y
order by 1,2;
quit;

proc transpose data=want2 out=final_want(drop=_name_);
by  node1;
var v;
id node2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1686477641440.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84874i70ABBBA72714C47B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1686477641440.png" alt="Ksharp_0-1686477641440.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 10:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880042#M347692</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-11T10:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880054#M347704</link>
      <description>&lt;P&gt;If the nodes are identified by a series of integers (and if not you could always just sort and number them)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the number of nodes is reasonable (and if not you are going to have a hard time doing calculations).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then just make a 2-D array.&amp;nbsp; You can then write the 2-D array out as a dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input from to ;
cards;
1  2
1  3
4  5
5  2
6  7
8  7
;

data matrix ;
  array x[8,8] _temporary_ (64*0);
  do until (eof);
    set have end=eof;
    x[from,to]=1;
    x[to,from]=1;
  end;
  do node=1 to 8;
    array nodes [8] node1-node8 ;
    do col=1 to 8;
      nodes[col]=x[node,col];
    end;
    output;
  end;
  keep node: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    node    node1    node2    node3    node4    node5    node6    node7    node8

 1       1       0        1        1        0        0        0        0        0
 2       2       1        0        0        0        1        0        0        0
 3       3       1        0        0        0        0        0        0        0
 4       4       0        0        0        0        1        0        0        0
 5       5       0        1        0        1        0        0        0        0
 6       6       0        0        0        0        0        0        1        0
 7       7       0        0        0        0        0        1        0        1
 8       8       0        0        0        0        0        0        1        0
&lt;/PRE&gt;
&lt;P&gt;If you want the main diagonal to be 1's then add this statement after the ARRAY statement in the DO NODE loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    nodes[node,node]=1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Jun 2023 14:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880054#M347704</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-11T14:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880060#M347705</link>
      <description>&lt;P&gt;If you want to use HASH() objects (which is useful if the NODE ids are not contiguous integers) then you can build the connectivity data into a single HASH that can be written to a dataset and then transposed.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
* Declare hashs and hiters ;
  declare hash nodes(ordered:'yes');
   nodes.definekey('node');
   nodes.definedata('node');
   nodes.definedone();
  declare hash links(ordered:'yes');
   links.definekey('from','to');
   links.definedata('from','to','x');
   links.definedone();
  declare hiter ifrom('nodes');
  declare hiter ito('nodes');
  x=1;
* read in the data and populate the hashes ;
  do until(eof);
    set have end=eof;
    links.replace(key:to,key:from,data:to,data:from,data: 1);
    links.replace(key:from,key:to,data:from,data:to,data: 1);
    node=from; nodes.replace();
    node=to; nodes.replace();
  end;
* Iterate over the list of nodes and fill in the zeros ;
* Set diagonal to ones ;
  rc1 = ifrom.first();
  do while (rc1 = 0);
    from = node;
    rc2 = ito.first();
    do while (rc2 = 0);
      to = node;
      rc3=links.add(key:from,key:to,data:from,data:to,data:(from=to));
      rc2 = ito.next();
    end;
    rc1 = ifrom.next();
  end;
* write out the links ;
  links.output(dataset:'links');
  stop;
run;

* Transpose ;
proc transpose data=links out=want(drop=_name_) prefix=to;
  by from;
  id to;
  var x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if you have this input data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input from $ to $ ;
cards;
1  FRED
1  3
4  5
5  FRED
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You get this result&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1686498043735.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84875iCB920C35781AD047/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1686498043735.png" alt="Tom_0-1686498043735.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 15:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880060#M347705</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-11T15:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880097#M347725</link>
      <description>&lt;P&gt;Thank you for the response!&amp;nbsp;Attached is an example of the data, and I can't figure out the SAS code for the adjacency matrices. The node IDs are randomly assigned (unique) integers and are important for later merging the centrality scores with other data.&amp;nbsp;Any help is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 21:34:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880097#M347725</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-11T21:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880099#M347727</link>
      <description>&lt;P&gt;Not allowed to download XLSX files so if you want to share example data please just post a data step that makes the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the real question is what are the statistics you want to calculate?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure it is easier to calculate from a "matrix" instead of the data you already have?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 22:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880099#M347727</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-11T22:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880101#M347729</link>
      <description>&lt;P&gt;&lt;A href="https://www3.nd.edu/~cone/centralities/nodecentrality.html" target="_self"&gt;This page&lt;/A&gt; references 7 different measures of node centrality.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which centrality measure do you want to calculate? And do you want to do the calculation with SAS or simply provide a well formatted file to other software?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 22:40:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880101#M347729</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2023-06-11T22:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880102#M347730</link>
      <description>&lt;P&gt;Ultimately, I want the centrality (eigenvector, degree, betweenness, closeness) scores for each node. I have done this in another software that takes only small data of ~100 nodes and it was easier to build the adj. matrix first and then calculate the centralities. Can that be skipped in SAS?&lt;/P&gt;&lt;P&gt;Node ID is a random integer (may as well be text) that's important for later merging with other data. Ex.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&amp;nbsp;infile cards ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;input from $ to $ ;&lt;BR /&gt;cards;&lt;BR /&gt;1&amp;nbsp; &amp;nbsp;3&lt;BR /&gt;1&amp;nbsp; &amp;nbsp;5&lt;BR /&gt;3&amp;nbsp; &amp;nbsp;5&lt;BR /&gt;3&amp;nbsp; &amp;nbsp;6&lt;BR /&gt;15 18&lt;BR /&gt;21 37&lt;BR /&gt;28 53&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 22:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880102#M347730</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-11T22:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880104#M347732</link>
      <description>Ultimately, I want the centrality (eigenvector, degree, betweenness, closeness) scores for each node, in SAS... I don't actually care for the intermediate steps. It was my assumption that I needed the adj. matrix before calculating the scores</description>
      <pubDate>Sun, 11 Jun 2023 22:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880104#M347732</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-11T22:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880105#M347733</link>
      <description>I have ~5,000 nodes.</description>
      <pubDate>Sun, 11 Jun 2023 22:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880105#M347733</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-11T22:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880111#M347739</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443540"&gt;@Max123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ultimately, I want the centrality (eigenvector, degree, betweenness, closeness) scores for each node, in SAS... I don't actually care for the intermediate steps. It was my assumption that I needed the adj. matrix before calculating the scores&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And how to you propose to calculate those scores?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know the algorithm needed?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 00:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880111#M347739</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-12T00:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880113#M347741</link>
      <description>found this example online:&lt;BR /&gt;proc netflow in=network out=degree_centrality action=stats;&lt;BR /&gt;stats degree / type=degree;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Jun 2023 00:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880113#M347741</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-12T00:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880180#M347778</link>
      <description>&lt;BR /&gt;Tom,&lt;BR /&gt;I think it is all depend on what OP are looking for.&lt;BR /&gt;We understand it in two different way.&lt;BR /&gt;According to your logistic , OP's question is very very simple .&lt;BR /&gt;I think OP should post an example to show his input dataset and output dataset.</description>
      <pubDate>Mon, 12 Jun 2023 11:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880180#M347778</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-12T11:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880182#M347779</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
I think you should post an example to show your input dataset and output dataset.
Tom and I understand it in two different way.
The following code is according to Tom's logistic.
*/
proc import datafile='c:\temp\book1.xlsx' out=_2005 dbms=xlsx replace;
sheet='2005';
run;
data have;
 set _2005;
 v=1;
 output;
 temp=node_ID; node_ID=linked_node_ID;linked_node_ID=temp;output;
 drop temp;
run;
proc sql;
create table want as
select a.*,coalesce(b.v,0) as v
 from  (
select * from
(select  node_ID as node_ID        from have union select linked_node_ID from have),
(select  node_ID as linked_node_ID from have union select linked_node_ID from have)
) as a natural left join (select distinct * from have) as b;
quit;
proc transpose data=want out=final_want(drop=_name_);
by node_ID;
var v;
id linked_node_ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jun 2023 11:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880182#M347779</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-12T11:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880287#M347806</link>
      <description>&lt;P&gt;These network (graph) statistics are now available from PROC OPTGRAPH, for which you need the SAS Network Algorithms license.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procgralg/procgralg_optgraph_details01.htm" target="_self"&gt;the procedure documentation&lt;/A&gt;, you only need a &lt;EM&gt;links&lt;/EM&gt; (i.e. from-to pairs) dataset to get it going.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The centrality statistics are requested with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/procgralg/procgralg_optgraph_syntax04.htm" target="_self"&gt;CENTRALITY statement&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 20:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880287#M347806</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2023-06-12T20:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880308#M347823</link>
      <description>Thank you both so much!!!</description>
      <pubDate>Mon, 12 Jun 2023 22:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880308#M347823</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-12T22:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880329#M347830</link>
      <description>unfortunately, I don't have that license. and PROC NETFLOW is not working...</description>
      <pubDate>Tue, 13 Jun 2023 01:29:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880329#M347830</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-13T01:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880338#M347834</link>
      <description>sorry to build on this... How can I multiply element-wise to adjacency matrices (e.g., final_want2005 and final_want2006)?&lt;BR /&gt;I'm trying this but it doesn't work:&lt;BR /&gt;&lt;BR /&gt;proc iml ; reset noprint ;&lt;BR /&gt;A = final_want2005[1:2,4710:4711] ;&lt;BR /&gt;B = final_want2006[1:2,4710:4711] ; c = A # B ;&lt;BR /&gt;run ;</description>
      <pubDate>Tue, 13 Jun 2023 03:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880338#M347834</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-13T03:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880395#M347863</link>
      <description>&lt;P&gt;This is a new question, should post it at IML forum.&lt;/P&gt;
&lt;P&gt;I check your LOG.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;56
57   A = final_want2005[1:2,4710:4711] ;
58   B = final_want2006[1:2,4710:4711] ;
ERROR: (execution) Invalid subscript or subscript out of range.

 operation : [ at line 58 column 19
 operands  : final_want2006, _TEM1001, *LIT1007, *LIT1008
&lt;STRONG&gt;final_want2006&lt;/STRONG&gt;   4694 rows   &lt;STRONG&gt;4695 cols&lt;/STRONG&gt;    (numeric)

_TEM1001      1 row       2 cols    (numeric)
&lt;/PRE&gt;
&lt;P&gt;final_want2006 only have 4695 columns unlike&amp;nbsp;final_want2005 have&amp;nbsp;4711 columns, so you can't do this element-wise operator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my running code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use final_want2005;
read all var _num_ into final_want2005;
close;
use final_want2006;
read all var _num_ into final_want2006;
close;

/*
x=ncol(final_want2005);
y=ncol(final_want2006);
print x y;
quit;
*/
A = final_want2005[1:2,4710:4711] ;
B = final_want2006[1:2,4710:4711] ; 
c = A # B ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 12:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880395#M347863</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-13T12:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: converting an edgelist dataset to an adjacency matrix, setting missing values as 0</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880396#M347864</link>
      <description>Thanks. The data was not complete for 2006 in the previous file - actually both matrices have the same dimensions given full data. The error it gave me from my code was about matrices not having assigned value.</description>
      <pubDate>Tue, 13 Jun 2023 12:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-an-edgelist-dataset-to-an-adjacency-matrix-setting/m-p/880396#M347864</guid>
      <dc:creator>Max123</dc:creator>
      <dc:date>2023-06-13T12:37:12Z</dc:date>
    </item>
  </channel>
</rss>

