Counting occurences in a variable

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

Counting occurences in a variable

Magnus Alderling
Hi!

In SPSS, I want to count number of cases coded as 1:s in a variable
defining each subject as either exposed or unexposed, doing so for a
couple of different strata, i.e there are 1000 cases, and it exists 10
strata. Furhermore our interest lies in estimating a weighted proportion
along with a weighted variance.

Does anyone know if this could be done?

Best regards!
Reply | Threaded
Open this post in threaded view
|

Re: Counting occurences in a variable

Mona E. Ahmed
I guess you can use Aggregate with Strata as your break variable
Reply | Threaded
Open this post in threaded view
|

Re: Counting occurences in a variable

Maguin, Eugene
In reply to this post by Magnus Alderling
Magnus,

Why won't crosstabs work? You must have thought of this. What am I missing/
Reply | Threaded
Open this post in threaded view
|

Re:Counting occurences in a variable

Jerabek Jindrich
In reply to this post by Magnus Alderling
Hi Magnus,

Crosstabs or split file and frequency will do.

Say you have a variable STRAT coded 1 to 10 and variable Var coded 1/0 (or 1 and missing?).

SORT CASES BY strat .
SPLIT FILE
  SEPARATE BY strat .
FRE Var.
This will give you 10 tables, one for each of your strata.

Crosstabd will work with 1/0 coded Var, if you have 1/missing recode it first:
RECODE Var (missing=0).
CROSSTABS
  /TABLES=strat  BY var
  /FORMAT= AVALUE TABLES
  /CELLS= COUNT ROW .
This gives you one table with 10 rows for each of your strata.

Weighted proportions:
Suppose you have a weighing coefficient (variable W).
Now weight the data by W:
WEIGHT by w.
And use the above synttax to get the weighted proportions.

What above the weighted variance, you said your variable of interest is 1/0.
Do you mean std err of the proportions? Pls let us know.

best regards
Jindra




> ------------ Původní zpráva ------------
> Od: Magnus Alderling <[hidden email]>
> Předmět: Counting occurences in a variable
> Datum: 08.5.2007 15:17:25
> ----------------------------------------
> Hi!
>
> In SPSS, I want to count number of cases coded as 1:s in a variable
> defining each subject as either exposed or unexposed, doing so for a
> couple of different strata, i.e there are 1000 cases, and it exists 10
> strata. Furhermore our interest lies in estimating a weighted proportion
> along with a weighted variance.
>
> Does anyone know if this could be done?
>
> Best regards!
>
>
>