/* this program runs the CROWDS macro on the high-school friendship network Modified to work w. the data for the RWJ workshop Author: Moody Date: Apr, 2007 */ libname in1 'c:\jwm\conferences\columbia\workshop\'; /* put the place were you copied s884dat.sd2 between the quote marks */ %include 'c:\jwm\sas\macros\crowds.mac'; %include 'c:\jwm\sas\macros\treelp_2.mac'; /* move the data to a temp spot. This is just being overly cautious, since I hate risking any changes to saved data... */ proc iml; reset storage = in1.netstore; load amatis amatis_id; amatis = amatis-diag(amatis); /* remove any self loops */ symnet = (amatis+amatis`)>0; /* make it sym */ reset storage = work.netstore; store symnet amatis amatis_id; quit; /* now run the CROWDS macro */ %crowds(symnet, /* name of the adjacency matrix */ amatis_id, /* node id variables for the network */ "MAX", /* how to make symmetric */ 5, /* maximum number of steps to take distance matrix */ 1.4, /* factor to separate nodes beyond that distance */ Ward, /* clustering method to use */ 30, /* maximum number of clusters to start with */ Y, /* do you want to see the dendrogram */ work.netstore, /* where the matrix is stored */ 1.8, /* how different two groups have to be to be merged together */ 15, /* maximum itterations for the first pass */ 7, /* maximum itterations for the second pass */ .07, /* how sensitive you want the treewalk procedure to be */ Y, /* do you want it to calculate the distance? */ work.scratch, /* where to store the distance matrix */ dmat, /* what to call the distance matrix */ d_id); /* name for the node id numbers of the distance matrix */ proc freq data=outd; tables grplab; run; proc means data=outd; class grplab; var fitval; run; /* write it out to PAJEK */ data dum; file "c:\jwm\conferences\columbia\workshop\crowd_examp.clu"; put "*Vertices 255"; run; data outd; set outd; file "c:\jwm\conferences\columbia\workshop\crowd_examp.clu" mod; put grplab; run;