* Regression with normed weight. * Raynald Levesque January 2003. DATA LIST LIST /race gender age region wgt. BEGIN DATA 1 1 1 1 150 1 2 1 1 200 1 1 2 1 170 1 2 2 1 230 1 1 1 2 180 1 2 1 2 210 1 1 2 2 150 1 2 2 2 240 2 1 1 1 120 2 2 1 1 250 2 1 2 1 140 2 2 2 1 210 2 1 1 2 190 2 2 1 2 200 2 1 2 2 100 2 2 2 2 200 END DATA. LIST. SAVE OUTFILE='c:\\temp\\my data.sav'. *///////////////. DEFINE !regres(criter=!CMDEND) GET FILE='c:\\temp\\my data.sav'. SELECT IF !criter. SAVE OUTFILE='c:\\temp\\temp data.sav'. COMPUTE nobreak=1. AGGREGATE OUTFILE=* /PRESORTED /BREAK=nobreak /n=N /totweigt=SUM(wgt). WRITE OUTFILE='c:\\temp\\norm syntax.sps' /'DEFINE !n()'n'!ENDDEFINE.' /'DEFINE !w()'totweigt'!ENDDEFINE.'. EXECUTE. INCLUDE 'c:\\temp\\norm syntax.sps'. GET FILE='c:\\temp\\temp data.sav'. COMPUTE normwt=!n * wgt / !w. DESCRIPTIVES VARIABLES=normwt /STATISTICS=MEAN . WEIGHT BY normwt. *. * Do your regression here. *. !ENDDEFINE. *///////////////. * Test macro. !regres criter=(gender=1 & race=2). !regres criter=(gender=2 OR race=1). * The average of normwt is 1 in both cases.