如何过滤变量的值

How to filter values of a variable

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

提前致谢! 埃米尔

这里有一些可以让您开始使用 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.