登录
首页精彩阅读常用的spss命令程序
常用的spss命令程序
2017-04-24
收藏

常用的spss命令程序

1.加标签程序
VARIABLE LABELS
    S1         "S1          How long have you lived here".
2.加值程序
value    labels   TIER
1       "Tier1"
2       "Tier2"
3       "Tier3"
4       "Tier4".
3.求均值程序
MEANS
  TABLES=f4a  BY a7b
  /CELLS MEAN  .

MEANS
  TABLES=Income  BY Sex2
  /CELLS MEAN COUNT STDDEV  .
4.Table 程序
* General Tables.
TABLES
  /FORMAT BLANK MISSING('.')
  /GBASE=CASES
  /TABLE=Citycode  BY Tier > (STATISTICS)  .

5.Recode语句
STRING MON (A20) .
RECODE
  Month
  (1='January')  (2='February')  (3='March')  (4='April')  (5='May')  (6='June')  (7='July')  (8='August')  (9='September')
  (10='October')  (11='November')  (12='December')  INTO  MON .
EXECUTE .

6.If语句
IF (salary <= 1200) tax = 0 .
EXECUTE .
7.

识别spss数据中的missing值

1.数值型

  IF (a = .)  b= 4.

当a为miss值时,b等于4

2.字符串型

IF (a=' ')  b= "abc".

当a为miss值时,b等于abc

3.利用miss函数

if (a>=12 and miss(b)=1)  c=1.
execute.
当a小于等12并且b为miss值时,c等于1


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

客服在线
立即咨询