比较OMS捕获的不同结果

时间:2018-02-21 01:04:39

标签: spss

在上一篇文章Scale Building in SPSS之后,我正在尝试使用Cronbach的alpha和alpha-if-deleted自动化缩放构建过程。手动过程要求我运行可靠性分析,然后检查alpha-if-deleted值以查看应从比例中删除哪些变量。这可能需要多次迭代,所以我试图自动化它。到目前为止,这是我的语法:

* Make sure output tables contain variable names only...

set onumbers values ovars names tnumbers values tvars names.

* OMS to capture the alpha coefficient

DATASET DECLARE  Alpha.
OMS
  /SELECT TABLES
  /IF COMMANDS=['Reliability'] SUBTYPES=['Reliability Statistics']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='Alpha' VIEWER=YES.

* OMS to capture the Item_totals.

DATASET DECLARE  Item_Totals.
OMS
  /SELECT TABLES
  /IF COMMANDS=['Reliability'] SUBTYPES=['Item Total Statistics']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='Item_Totals' VIEWER=YES.

* Running the reliability analysis

RELIABILITY
  /VARIABLES=Binary_12085 Binary_12213 Binary_18007 Binary_19829 Binary_19830 Binary_4451 
    Binary_4465 Binary_5140 Binary_5149 Binary_8513
  /SCALE('Original Scale') ALL
  /MODEL=ALPHA
  /SUMMARY=TOTAL. 

下一步是将Alpha数据集(变量名称:CronbachsAlpha)的alpha值与CronbachsAlphaifItemDeleted(在Item_Totals数据集中)进行比较,并选择Var1(Item_Totals数据集)中的值,其中CronbachsAlphaifItemDeleted< = CronbachsAlpha。一旦我可以从Var1中捕获该列表,我希望将其重新用于语法以对这些变量运行下一个可靠性分析。

1 个答案:

答案 0 :(得分:1)

以下将创建一个宏,其中只包含您指定的变量的名称。

首先,这将创建一些示例数据并重新创建您描述的情况(使用您的语法):

data list free/Binary_12085 Binary_12213 Binary_18007 Binary_19829 Binary_19830 
    Binary_4451 Binary_4465 Binary_5140 Binary_5149 Binary_8513 (10f2).
begin data
1 0 1 0 1 1 1 0 1 1 0 1 0 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0
end data.

***THE FOLLOWING IS A COPY OF THE SYNTAX IN THE ORIGINAL QUESTION.**

* Make sure output tables contain variable names only...
set onumbers values ovars names tnumbers values tvars names.
* OMS to capture the alpha coefficient
DATASET DECLARE  Alpha.
OMS   /SELECT TABLES   /IF COMMANDS=['Reliability'] SUBTYPES=['Reliability Statistics']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_    OUTFILE='Alpha' VIEWER=YES.
* OMS to capture the Item_totals.
DATASET DECLARE  Item_Totals.
OMS   /SELECT TABLES   /IF COMMANDS=['Reliability'] SUBTYPES=['Item Total Statistics']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_    OUTFILE='Item_Totals' VIEWER=YES.
* Running the reliability analysis.
RELIABILITY   /VARIABLES=Binary_12085 Binary_12213 Binary_18007 Binary_19829 Binary_19830 
Binary_4451 Binary_4465 Binary_5140 Binary_5149 Binary_8513
  /SCALE('Original Scale') ALL   /MODEL=ALPHA  /SUMMARY=TOTAL. 
omsend.

现在我们有两个带有两个结果的数据集。以下语法匹配它们,选择要保留的相关变量,然后创建一个名为!keepers的宏,其中包含它们的名称:

match files/file=item_totals/table=alpha/by Command_ 
    /keep var1 CronbachsAlphaifItemDeleted CronbachsAlpha.
select if CronbachsAlphaifItemDeleted <= CronbachsAlpha.
flip newnames=var1.
spssinc select variables macroname="!keepers"/PROPERTIES  PATTERN = "Binary_*".

您现在可以在语法中使用变量列表,例如:

frequency !keepers .