* Process for creating Dummy Variables for use in Regression Analysis ***************** . * Created Dec 2002 by John Painter . * It's a little clunky but gets the job done . * This example assumes there are six levels of the variable to be coded thus five dummy variables are created. * The first group is the group that is held-out (in conventional effect coding this would be the group getting all -1's) . * This section creates Dummy codes for weighted analysis, which requires that the first * group be a negative weight of the proportions relative to that group (see Applied Multiple * Regression / Correlation Analysis for the Social Sciences, Cohen, Cohen, West, Aiken for more details) . GET FILE='C:\data file.sav'. AGGREGATE /OUTFILE='C:\CURR_COUNT.sav' /BREAK=group /N_BREAK = N. GET FILE='C:\CURR_COUNT.sav'. * It should be possible to get the denominator value dynamically from the data . * But for now, visually inspect file to determine size of first group which in this case is 420 . COMPUTE wt = n_break / 420 . EXECUTE . CREATE wt1 to wt5 = LEAD(wt, 1, 5). EXEC . SAVE OUTFILE='C:\CURR_COUNT.sav' /COMPRESSED. *** Open original data file, sort and merge aggregate to get counts for each curriculum external file is keyed file . GET FILE='C:\data file.sav'. SORT CASES BY group (A) . MATCH FILES /FILE=* /TABLE='C:\CURR_COUNT.sav' /BY group. EXECUTE. ** Visual inspection indicates first group N = 420 . **** Make dummy codes for contrast used in weighted effects regression. Vector v (5, F5.3) . Vector w = wt1 to wt5 . Do Repeat I = 1 to 5 . COMPUTE v(I) = 0. IF (group = I + 1) v(I) = 1. IF group = 1 v(I) = w(I)*(-1) . END REPEAT . EXEC .