Login  Register

Re: count problem

Posted by Maguin, Eugene on Apr 26, 2007; 8:46pm
URL: http://spssx-discussion.165.s1.nabble.com/count-problem-tp1075304p1075306.html

Christian,

>i have a dataset with a person and a household id.

May I assume that the person id is called 'id and the household id is called
'sampid'?

>i want spss to simply count the different households so that i would get
a dataset that looks like the following

The simplest way to count households (sampid) is to use the Aggregate
command.

Aggregate outfile=*\break=sampid\count=n.

Read up on it in the syntax reference. But, the resulting dataset will look
like this.


Sampid          count
1104200032700     2
1104200057500     2
1104200181600     2
1104200213200     1
1104200235500     2
1104200245000     1


Please explain how you computed this

id      sampid
1       1
2       1
3       2
4       2
5       3
6       3
7       4
8       5
9       5
10      6

From this

id      sampid
1       1104200032700
2       1104200032700
3       1104200057500
4       1104200057500
5       1104200181600
6       1104200181600
7       1104200213200
8       1104200235500
9       1104200235500
10      1104200245000


Gene Maguin