COMPUTE Age=DATEDIFF($TIME,BirthDate,"years").
EXECUTE.
SAVE OUTFILE=‘D:\MaryKay\Data\PRD\ConsultantInfoPrd.sav‘
/COMPRESSED.
SAVE OUTFILE=‘D:\MaryKay\Data\PRD\ConsultantInfoPrd.sav‘
/COMPRESSED.
STRING AgeGroup1 (A8).
RECODE Age (19 thru 24=‘19~24‘) (25 thru 29=‘25~29‘) (30 thru 34=‘30~34‘) (35 thru 39=‘35~39‘) (40 thru 44=‘40~44‘) (45 thru
49=‘45~49‘) (50 thru 54=‘50~54‘) (55 thru 59=‘55~59‘) (ELSE=‘60以上‘) INTO AgeGroup1.
EXECUTE.
STRING AgeGroup2 (A8).
RECODE Age (19 thru 29=‘19~29‘) (30 thru 39=‘30~39‘) (40 thru 49=‘40~49‘) (50 thru 59=‘50~59‘) (ELSE=‘60以上‘) INTO AgeGroup2.
EXECUTE.
SPSS根据生日计算年龄并分组,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/monkeyfather/p/3868466.html