如何过滤变量的值

时间:2017-09-07 12:19:45

标签: statistics spss

对于学校作业,我目前正在与SPSS合作,并希望分析我们从客户收到的数据包。 例如;当我有三个变量时,其中两个是性别,年龄,第三个是受访者在一天开始时饮用的饮料。在我的分析中,我只想看到男性在20到30岁之间喝咖啡的百分比。我必须用什么功能才能完成这样的事情?

提前致谢! 埃米尔

1 个答案:

答案 0 :(得分:1)

有几种可能性可以让您开始使用SPSS语法:

如果你只想得到这个百分比的答案你可以这样做 -

compute dr_cofee=(drink="Cofee").
value labels dr_cofee
0 "other drinks"
1 "cofee".
compute men20_30=range(age, 20, 30) and gender="men".
filter by men20_30.
freq dr_cofee.
filter off.

另一方面,您可以概括您的分析 首先创建年龄组,然后在每个AgeGroup内进行分析:

recode age (1 thru 19=1)(20 thru 29=2)(30 thru 39=3)([continue as needed]) into AgeGroup. 
value labels AgeGroup
1 "ages 1 - 19"
2 "ages 20 - 29". /* continue as needed.
sort cases by gender AgeGroup.
split file by gender AgeGroup.
freq Drink.
split file off.
相关问题