登录
首页精彩阅读解析spss常用程序
解析spss常用程序
2016-08-10
收藏

解析spss常用程序

1、读入数据的程序:

DATA LIST LIST
  /id (F3) Interview_date (ADATE10) Age (F3) Gender (A1) 
   Income_category (F1) Religion (F1) opinion1 to opinion4 (4F1).

解释:要读入数据的变量,例如:id为变量名,后面的(F3)表示数字型的程度为3(可根据需要设计),依次类推A1表示字符的长度为1
BEGIN DATA(开始读入数据)
150 11/1/2002 55 m 3 4 5 1 3 1
272 10/24/02 25 f 3 9 2 3 4 3
299 10-24-02 900 f 8 4 2 9 3 4
227 10/29/2002 62 m 9 4 2 3 5 3
216 10/26/2002 39 F 7 3 9 3 2 1
228 10/30/2002 24 f 4 2 3 5 1 5
333 10/29/2002 30 m 2 3 5 1 2 3
385 10/24/2002 23 m 4 4 3 3 9 2
170 10/21/2002 29 f 4 2 2 2 2 5
391 10/21/2002 58 m 1 3 5 1 5 3
END DATA.(结束读入)

2、对变量添加名称(简单的说就是数据库中变量的意思是什么?)

VARIABLE LABELS
  Interview_date "Interview date"
  Income_category "Income category"
  opinion1 "Would buy this product"
  opinion2 "Would recommend this product to others"
  opinion3 "Price is reasonable"
  opinion4 "Better than a poke in the eye with a sharp stick".

解析:

VARIABLE LABELS

变量名(  Interview_date )  要赋予的变量名称(Interview date)

3、为变量中的数值添加lable

VALUE LABELS
  Gender "m" "Male" "f" "Female"(对字符型赋值)
  /Income_category 1 "Under 25K" 2 "25K to 49K" 3 "50K to 74K" 4 "75K+"
  7 "Refused to answer" 8 "Don't know" 9 "No answer"
  /Religion 1 "Catholic" 2 "Protestant" 3 "Jewish" 4 "Other" 9 "No answer"
  /opinion1 TO opinion4 1 "Strongly Disagree" 2 "Disagree" 3 "Ambivalent" 
  4 "Agree" 5 "Strongly Agree" 9 "No answer".

解析:

VALUE LABELS
  Gender "m" "Male" "f" "Female"(对字符型赋值Gernder表示要赋值的变量名,比如运行以后表示“F”代表female,“M”表示Male)

数据型的:Income_category 1 "Under 25K" 2 "25K to 49K" 3 "50K to 74K" 4 "75K+"(对数值型赋值,Income_category 表示要赋值的变量名,比如运行以后表示1代表Under 25K,2表示25K to 49K,依次类推)

4、缺失值处理

MISSING VALUES 
  Income_category (7, 8, 9)
  Religion opinion1 TO opinion4 (9).

解析:MISSING VALUES  Income_category (7, 8, 9)(表示将Income_category变量中的7\8\9认为是缺失值,可根据自己的目的处理,自行修改)

5、修改变量的类型:

VARIABLE LEVEL 
  Income_category, opinion1 to opinion4 (ORDINAL)
  Religion (NOMINAL).

6、检查

DISPLAY DICTIONARY.(运行即可,看见数据库的所有信息)

解析:VARIABLE LEVEL  Income_category, opinion1 to opinion4 (ORDINAL)(表示把Income_category,opinion1 to opinion4的变量改为定序变量)可根据分析的进行修改


数据分析咨询请扫描二维码

客服在线
立即咨询