help for stata2pajek

Export data to Pajek .net format

stata2pajek ego alter[, edges tiestrength() filename()]


stata2pajek exports data to the ".net" format read by Pajek, Network Workbench, and many other social network analysis packages.


The program assumes that you already have used Stata to create an edge list or arc list. You specify which (string or numeric) variable identifies ego and which alter. Specifying a tie strength variable is optional. stata2pajek converts this to .net format, which is a Windows-formatted text file beginning with a list of vertices (aka nodes) and their labels, followed by a list of ties (arcs or edges).

As an alternative to this program, you may wish to use outsheet then process the saved output with the Windows program txt2pajek.

Note that stata2pajek treats the Stata versions of your id variables as labels even if they are numeric. Thus if you have a node called #15 in Stata it will not necessarily also be called #15 in Pajek. Please see the vertice section of the .net file (which is human-readable text) to see the correspondence.

Options edges specifies that ties should be treated as edges (symmetrical ties). The default is to treat ties as arcs (directed ties).

filename() allows you to name the output file. By default it is named mypajekfile.net


. *create a random network with 10 nodes and export it as pajek . clear . set obs 200 . gen i=int(uniform()*10)+1 . gen j=int(uniform()*10)+1 . contract i j, freq(strength) . drop if i==j . sort i j . stata2pajek i j, tiestrength(strength) filename(samplerandomnetwork)


Gabriel Rossman, UCLA rossman@soc.ucla.edu

Also see

On-line: help for outsheet