/* this program uses the SPAN translation programs, PAJWRITE.MOD and UCIWRITE.MOD to translate a SAS IML file into a PAJEK or a UCINET file. To do so, you first use a FILE statement to name the file you want to create, then you call the module. The example below uses a small network, but you can use any data. Author: Jim Moody Date: December 30, 2000 */ proc iml; %include 's:\fac\jwm\span\pajwrite.mod'; /*stored program that creates a pajek network file */ %include 's:\fac\jwm\span\pajpart.mod'; /*stored program that creates a pajek partition file */ %include 's:\fac\jwm\span\uciwrite.mod'; /* stored program that creates a UCINET .dl file */ adj=j(10,10,0); /* blank 10 by 10 matrix */ /* now use a list of statements to fill in the adjacency matrix */ adj[1,2]=1; /* set row 1, column 2 of matrix ADJ to 1 */ adj[1,3]=1; /* dito, row 1 column 3 */ adj[1,{4 5 6}]=1; /* faster way to do above, list all of the columns in row 1 that are to be changed to 1 */ adj[2,{1 3 6 7}]=1; adj[3,{2 4}]=1; adj[4,{3 5 8}]=1; adj[5,{4 6}]=1; adj[6,{5 2}]=1; adj[7,2]=1; adj[8,4]=1; adj[9,5]=1; adj[10,6]=1; mattrib adj format=1.0; /* mattrib affects only the printing quality */ print adj; /* just to look at it */ /* now write the file to pajek. To do so, we need an id column. The ID can be anything, here I've made up column of letters, though you would usually have read the IDs from the dataset */ names={a,b,c,d,e,f,g,h,i,j}; /* separate by commas = columns */ part={1 1 2 2 1 1 2 2 1 1}; /* a simple male-female partition */ part=part`; file 'c:\moody\classes\soc884\examples\translate.net'; /* change the directory to your own space */ call pajwrite(adj,names,2); /* call the PAJEK writing program */ file 'c:\moody\classes\soc884\examples\translate.clu'; /* change the directory to your own space */ call pajpart(part); /* call the PAJEK writing program */ /* now write a UCINET file. UCINET has more options, but it is essentially the same */ file 'c:\moody\classes\soc884\examples\tranlate.dl'; /* change the directory to your own space */ call uciwrite(adj,names,names`,2); quit;