2

我为 OLS 编写了以下 SPSS 语法。对我来说,这很容易阅读。不同的变量被分组在一行中,并且注释描述了它们是什么:

/* model (3d) hbs returns IV, lag DV, IV lag 1 and 2
REGRESSION 
  /MISSING LISTWISE 
  /STATISTICS COEFF OUTS R ANOVA 
  /CRITERIA=PIN(.05) POUT(.10) 
  /NOORIGIN 
  /DEPENDENT retExc0
  /METHOD=ENTER 
  hbsVol0LN hbsBullQuality0 hbsAgreeQuality0 wiki0LN svi0 /* independent
  retExc1 retExc2 /* lag dependent
  hbsVol1LN hbsBullQuality1 hbsAgreeQuality1 Wiki1LN svi1 /* lag 1 independent
  hbsVol2LN hbsBullQuality2 hbsAgreeQuality2 Wiki2LN svi2 /* lag 2 independent
  secEnergy secMat secIndus secConsS secHealth secFin secIT secTelco secUtil /* control
  dayMon dayTue dayWed dayFri /* control
  news
  marketRet0 
  day01 day02 day03 day04 day05 day06 day07 day08 day09 day10 day11 day12 day13 day14 day15 day16 day17 day18 day19 day20 day21 day22 day23 day24 day25 day26 day27 day28 day29 day30 day31
  /RESIDUALS DURBIN.

然而,语法解释器不接受这一点,它期望所有变量都直接在回归之后/MEHOD

/* model (3d) hbs returns IV, lag DV, IV lag 1 and 2
REGRESSION 
  /MISSING LISTWISE 
  /STATISTICS COEFF OUTS R ANOVA 
  /CRITERIA=PIN(.05) POUT(.10) 
  /NOORIGIN 
  /DEPENDENT retExc0
  /METHOD=ENTER hbsVol0LN hbsBullQuality0 hbsAgreeQuality0 wiki0LN svi0 retExc1 retExc2 hbsVol1LN hbsBullQuality1 hbsAgreeQuality1 Wiki1LN svi1 hbsVol2LN hbsBullQuality2 hbsAgreeQuality2 Wiki2LN svi2 secEnergy secMat secIndus secConsS secHealth secFin secIT secTelco secUtil dayMon dayTue dayWed dayFri news marketRet0 day01 day02 day03 day04 day05 day06 day07 day08 day09 day10 day11 day12 day13 day14 day15 day16 day17 day18 day19 day20 day21 day22 day23 day24 day25 day26 day27 day28 day29 day30 day31
  /RESIDUALS DURBIN.

然而,这看起来并不容易维护。如何连接变量行,以便解释器接受我的原始输入,例如:

/* model (3d) hbs returns IV, lag DV, IV lag 1 and 2
REGRESSION 
  /MISSING LISTWISE 
  /STATISTICS COEFF OUTS R ANOVA 
  /CRITERIA=PIN(.05) POUT(.10) 
  /NOORIGIN 
  /DEPENDENT retExc0
  /METHOD=ENTER ;
  hbsVol0LN hbsBullQuality0 hbsAgreeQuality0 wiki0LN svi0 ;
  retExc1 retExc2 ;
  hbsVol1LN hbsBullQuality1 hbsAgreeQuality1 Wiki1LN svi1 ;
  hbsVol2LN hbsBullQuality2 hbsAgreeQuality2 Wiki2LN svi2 ;
  secEnergy secMat secIndus secConsS secHealth secFin secIT secTelco secUtil ;
  dayMon dayTue dayWed dayFri ;
  news ;
  marketRet0 ;
  day01 day02 day03 day04 day05 day06 day07 day08 day09 day10 day11 day12 day13 day14 day15 day16 day17 day18 day19 day20 day21 day22 day23 day24 day25 day26 day27 day28 day29 day30 day31
  /RESIDUALS DURBIN.

这样的事情可能吗?如果可以,怎么办?

4

2 回答 2

1

以下语法与您的语法结构相同,我没有遇到任何错误。它工作正常。

/* model (3d) hbs returns IV, lag DV, IV lag 1 and 2.
REGRESSION 
  /MISSING LISTWISE 
  /STATISTICS COEFF OUTS R ANOVA 
  /CRITERIA=PIN(.05) POUT(.10) 
  /NOORIGIN 
  /DEPENDENT y
  /METHOD=ENTER 
  x1 x2 x3 /* independent
  x4 x5 /* lag dependent
  x6 x7 x8 x9 /* lag 1 independent
  x10 x11 x12 x13 /* lag 2 independent
  x14 x15 x16 /* control
  x17 x18 x19 /* control
  x20
  x21 
  x23 x24 x25 x26 x27 x28 x29 x30
  /RESIDUALS DURBIN.
于 2012-09-06T07:37:33.207 回答
1

换行符在统计语法中是完全可以接受的。如果您发布了您收到的实际错误消息,这将有所帮助。也许有一个非打印字符在那个混淆的东西上。

一个完全空白的行终止命令,但这里似乎不是这种情况。

通常,在交互模式(甚至生产语法通常使用)中,命令会一直持续到空行或终止句点,并且换行是无关紧要的。(多行文字需要额外注意。)

于 2012-09-06T20:47:08.183 回答