help to generate a count variable

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

help to generate a count variable

jing zhang-2
Hey all,

I am trying to generate a count variable, which records the number of
observations of the variable. For example, for hypothetical variable "V1"
seen below, I want to generate a variable "Count_V1" which should be able to
read a value equal to 5.



V1

2

3

11

-4

22


Any help will be highly appreciated.

Jing

=====================
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: help to generate a count variable

Maguin, Eugene
Jing,

From your example, it looks like you want a count of cases. As I hope you
know, 'count' is the name of a command that counts occurrances of values
across a list of variables. You don't say what you want to do with the case
count which matters because that affects how the count is done. Also you
don't say what to do if V1 has any missing values. Are those cases counted?
The simplest way to get a case count is to do a descriptives or a
frequencies command on the variable. Another way is through an aggregate
command (you'll need to add a 'break' variable to the dataset and give it
the same value for each case). Unless what I've said thus far answers your
question, you'll need to provide a better description of what you want to
do.

Gene Maguin


>>I am trying to generate a count variable, which records the number of
observations of the variable. For example, for hypothetical variable "V1"
seen below, I want to generate a variable "Count_V1" which should be able to
read a value equal to 5.

V1
2
3
11
-4
22

=====================
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