统计211
标题:
SPSS常用程序
[打印本页]
作者:
linxiuquan001
时间:
2011-6-18 11:26
标题:
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
m 3 4 5 1 3 1
272
f 3 9 2 3 4 3
299
f 8 4 2 9 3 4
227
m 9 4 2 3 5 3
216
F 7 3 9 3 2 1
228
f 4 2 3 5 1 5
333
m 2 3 5 1 2 3
385
m 4 4 3 3 9 2
170
f 4 2 2 2 2 5
391
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的变量改为定序变量)可根据分析的进行修改
欢迎光临 统计211 (http://www.tj211.com/)
Powered by Discuz! X3.2