统计211

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3508|回复: 0
打印 上一主题 下一主题

SPSS常用程序

[复制链接]
跳转到指定楼层
1
发表于 2011-6-18 11:26:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
       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的变量改为定序变量)可根据分析的进行修改
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


免责声明|关于我们|小黑屋|联系我们|赞助我们|统计211 ( 闽ICP备09019626号  

GMT+8, 2025-4-19 21:00 , Processed in 0.088111 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表