*file called influence1.sas in the influence directory; *This makes the new influence variables from pstar.list and pblfs.list; LIBNAME LIBREF "c:\myfiles\courses\seminar\seminar\software."; libname in1 "c:\myfiles\mtip\2002 study\"; libname libs "c:\myfiles\courses\seminar\seminar\software."; options nocenter; options linesize=120; options pagesize=58; options linesize=78; * first making the list file for a given y variable using existing data set backg3; *commenting out the making of yvar.list for now; *data one; *set in1.backg3; *file "yvar.list"; *one=1; *if magent ne . and oldid ne . then put oldid 1-3 one 6 @8 magent 10.5; *run; data kendat; infile "c:\myfiles\courses\seminar\seminar\software\influence.list"; input person1 person2 relate; proc sort; by person1 person2; data blfsdat; infile "c:\myfiles\courses\seminar\seminar\software\yvar.list"; input person1 person2 yvar; proc iml; reset storage=libs.stor6; load; filename datfile 'c:\myfiles\courses\seminar\seminar\software\influence.dat'; use kendat; read all into kendat; use blfsdat; read all into blfsdat; numpeop=6; run getscin3(kendat,numpeop,socmtx,group); numdyads=numpeop*(numpeop-1); *Below is a call to the module that generates "attdif" -- ATTDIF is a 'numpeop*(numpeop-1) by 1' matrix of attitude differences. See the module at the bottom of newlib1.sas for more details. Given that ATTDIF is the same length as the other predictor matrices, it can easily be used as a predictor in the PSTAR regression.; run blfsdif(blfsdat,attdif); print attdif; *Below is a call to the module that calculates Wy for in-group and out-group members. See the (other) module at the bottom of newlib1.sas for the code. NOTE: You MUST run getscin2 or getscin3 BEFORE running this module.; run inoutwy(socmtx,blfsdat(|,3|),group,inwy,outwy,totwy); *file datfile; totn=0; DO I=1 TO numpeop; file datfile; put i 10.5 @; PUT (inwy[I]) 10.5 @; put (outwy[I]) 10.5 @; put (totwy[I]) 10.5; Do j=1 to numpeop; totn=totn+1; if j=i then totn=totn-1; file "c:\myfiles\courses\seminar\seminar\software\attdiff.dat"; if j>i then do; put (i) 10.0 @; put (j) 10.0 @; counter=totn; if counter=0 then counter=1; put (attdif[counter,1]) 10.5; end; end; END; CLOSEFILE datfile; print inwy; print outwy; print totwy; run; *The following code is in newlib1.sas. it must be run first in order to make procedure inoutwy: *start inoutwy(socmtx,outcomes,group,inwy,outwy,totwy) global (numpeop); *totwy=socmtx*outcomes; *blkgroup=diag(group); *do i = 1 to nrow(blkgroup); * do j = 1 to ncol(blkgroup); * if blkgroup(|i,i|)=blkgroup(|j,j|) then blkgroup(|i,j|)=blkgroup(|i,i|); * end; *end; *do i = 1 to nrow(blkgroup); * do j = 1 to ncol(blkgroup); * if blkgroup(|i,j|)>1 then blkgroup(|i,j|)=1; * end; *end; *socmtxin=socmtx#blkgroup; *inwy=socmtxin*outcomes; *outwy=totwy-inwy; *finish inoutwy;