David A. Kenny

June 19, 2011

 

Social Relations Model Macro

 

This macro, called SRMText, was written by David A. Kenny, Department of Psychology, University of Connecticut (please email me).  This is Version 1, completed on August 25, 2009.  Small revisions were made in June 1011.  ;This macro has been replaced by shiny app that can be accessed at SRM_R and a brief description is available on https://davidakenny.net/DyadR/DyadRweb.htm#SRM_R>DyadR page.

 

Download:

SRMText.SAS (You need SAS to open this and the next 4 files.)

Sample Data File

Macro Call

SAS Output

SAS Log

Macro Output (You do not need SAS to open this file.) 

 

To understand how to run a macro, return to the DataToText page.  The macro takes a few minutes to run and so be patient.  Make sure to backup the raw data file, as sometimes an error in the macro can alter the data file.  Note the output (the text file) cannot be viewed in SAS.  It is best viewed with Notepad with wordwrap.

 

Data Preparation

The data file needs to have one record per dyadic observation.  So if there are four person in each group, there would be 12 (4 times 3) observations per group. If there are self data, they would be dropped from the data set.  On the record is the outcome variable, called "outcome," a variable that designates the group number, called "group," a variable designating the actor, called "actor," and a variable designating the partner, called partner.  The group variable can be any alphanumeric variable, but the actor and partner variables must be numeric integer variables that range from 1 up to 25.  Note also that for a given actor, say actor 1, is for some people, partner 1.  For a given actor and partner, there can be only one replication.

 

Estimation Method

 

The program creates dummy variables for each actor and partner and creates constraints in the variance-covariance matrix of these dummy variables, called the tau matrix in HLM.  To learn more about the data file, click here.

 

The Macro Call

This is the statement for the sample data:

%SRMText (outcome=composite,oname='Leader',dir='C:\',file=LORD,
actor=actor,partner=partner,ofile='c:\srmtext.txt')

 

 

SRMText was written on SAS 9.1 and there is no guarantee that it work on earlier or later versions of SAS.

 

The macro:

allows for only a single outcome variable and no predictor (i.e., fixed) variables (such variable could added to the "Model" statement of the macro, but there results would not be described in the text output),

presumes that the outcome is measured on an interval scale,

and allows for missing data and unequal group sizes, and

 

Variables in the macro:

 

   outcome = name of the outcome variable in the SAS dataset (do not use quotes)

   oname = name of the outcome variable in the outfile (use quotes)

   dir = directory where the SAS dataset exits (use quotes)

   file = name of the dataset (do not exclude the extension or use quotes)

   actor = name of the actor variable (do not use quotes)

   partner = name of the partner variable (do not use quotes)

   group = name of the group variable (do not use quotes)

   ofile = the name of the output file (use quotes); this is where you go to find the text output

The defaults are as follows:

outcome = outcome

oname = 'Outcome'

dir = 'C:\'

file = data

actor = actor

partner = partner 

group = group

ofile = 'c:\srmtext.txt'

 

There is no guarantee of accuracy. Examine not only the output file, but also the SPSS output file.  Almost certainly you will need to edit the DataToText output in research reports.  Note too that if a variance component is zero or negative, SAS gives its p value as zero, when it should be instead 1.00.

 

Macro Output

 

using sample data (material in purple in annotations to explain the text):

 

If Notepad is used make sure you use the wordwrap option in formal.  Also for the tables to align use Courier font.

 

     The grand mean for the Leader is equal to 3.631.  The relative group variance is equal to 0. The relative actor variance is equal to 0.203, which is statistically significant (p < .001).  [An alpha of .05 is used by SRMText.]  The relative partner variance is equal to 0.527, which is statistically significant (p < .001). The relative error variance is equal to 0.27.  The actor-partner correlation is equal to 0.169, which is not statistically significant (p = 0.307). The dyadic correlation is equal to 0.189, which is not statistically significant (p = 0.267).  [More will be added to this output. Let me know what you want.]

 

Return to the DataToText Page