Counts conditioned on variable values.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Counts conditioned on variable values.

Boris Ratchev
Hello everyone,

I need to create a count list based on the values of a number of variables, and I have not come up with a good solution so far. Here is how I'd like the result set to look like:

basecode gender residence deployment rank pop size (Count)
1 Female Off Base Deployed E1 - E4 30
1 Female Off Base Deployed E5 - E6 19
1 Female Off Base Deployed E7 - E9 4
1 Female Off Base Deployed O1 - O3 3
1 Female Off Base Deployed O4 - Higher 1
1 Female Off Base Not Deployed E1 - E4 56
1 Female Off Base Not Deployed E5 - E6 69
1 Female Off Base Not Deployed E7 - E9 10
1 Female Off Base Not Deployed O1 - O3 15
1 Female Off Base Not Deployed O4 - Higher 11
1 Female On Base Deployed E1 - E4 9
1 Female On Base Deployed E5 - E6 1
1 Female On Base Not Deployed E1 - E4 24
1 Female On Base Not Deployed E5 - E6 9

The last column is a count of the occurences based on the combination of values which the variables "basecode", "gender", "residence", "deployment", and "rank" can take.

Help please.

Thanks!

Boris Rachev
Fairfax, VA

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Counts conditioned on variable values.

Art Kendall
Open a new instance of SPSS.  Copy, Paste, and Run the syntax below.

Is this what you are looking for?

data list fixed /
basecode 1
gender 3-8 (a)
residence 10-17 (a)
deployment 19-30 (a)
rank 32 - 42 (a)
Kount 44-45.
begin data
1 Female Off Base Deployed     E1 - E4     30
1 Female Off Base Deployed     E5 - E6     19
1 Female Off Base Deployed     E7 - E9      4
1 Female Off Base Deployed     O1 - O3      3
1 Female Off Base Deployed     O4 - Higher  1
1 Female Off Base Not Deployed E1 - E4     56
1 Female Off Base Not Deployed E5 - E6     69
1 Female Off Base Not Deployed E7 - E9     10
1 Female Off Base Not Deployed O1 - O3     15
1 Female Off Base Not Deployed O4 - Higher 11
1 Female On Base  Deployed     E1 - E4      9
1 Female On Base  Deployed     E5 - E6      1
1 Female On Base  Not Deployed E1 - E4     24
1 Female On Base  Not Deployed E5 - E6      9
2 Male   Off Base Deployed     E1 - E4     30
2 Male   Off Base Deployed     E5 - E6     19
2 Male   Off Base Deployed     E7 - E9      4
2 Male   Off Base Deployed     O1 - O3      3
2 Male   Off Base Deployed     O4 - Higher  1
2 Male   Off Base Not Deployed E1 - E4     56
2 Male   Off Base Not Deployed E5 - E6     69
2 Male   Off Base Not Deployed E7 - E9     10
2 Male   Off Base Not Deployed O1 - O3     15
2 Male   Off Base Not Deployed O4 - Higher 11
2 Male   On Base  Deployed     E1 - E4      9
2 Male   On Base  Deployed     E5 - E6      1
2 Male   On Base  Not Deployed E1 - E4     24
2 Male   On Base  Not Deployed E5 - E6      9
end data.
weight by kount.
frequencies variables= basecode to rank.
crosstabs tables = gender by residence by deployment by rank
 /residence by deployment/ rank by gender.

Art Kendall
Social Research Consultants

Boris Ratchev wrote:

> Hello everyone,
>
> I need to create a count list based on the values of a number of variables, and I have not come up with a good solution so far. Here is how I'd like the result set to look like:
>
> basecode gender residence deployment rank pop size (Count)
> 1 Female Off Base Deployed E1 - E4 30
> 1 Female Off Base Deployed E5 - E6 19
> 1 Female Off Base Deployed E7 - E9 4
> 1 Female Off Base Deployed O1 - O3 3
> 1 Female Off Base Deployed O4 - Higher 1
> 1 Female Off Base Not Deployed E1 - E4 56
> 1 Female Off Base Not Deployed E5 - E6 69
> 1 Female Off Base Not Deployed E7 - E9 10
> 1 Female Off Base Not Deployed O1 - O3 15
> 1 Female Off Base Not Deployed O4 - Higher 11
> 1 Female On Base Deployed E1 - E4 9
> 1 Female On Base Deployed E5 - E6 1
> 1 Female On Base Not Deployed E1 - E4 24
> 1 Female On Base Not Deployed E5 - E6 9
>
> The last column is a count of the occurences based on the combination of values which the variables "basecode", "gender", "residence", "deployment", and "rank" can take.
>
> Help please.
>
> Thanks!
>
> Boris Rachev
> Fairfax, VA
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants