How do I get the number of unique cases used to get the frequency of the other variable using SPSS? -
i have 2 columns, containing person's data on repeated measurements , other 1 presence or absence of characteristic.
data reads (column wise);
- patient_code : 1 1 2 2 2 3 4 5 5 6 6
- characteristic: n y y y n n n y y n n
i want number of unique cases used frequencies in other variable. ex:
y - 5 (from 3 cases/patients)
n - 6 (from 5 cases/patients).
how do using spss. have several characteristics this.
the trick here create unique identifier of patients within each exposed group. sort cases
followed match files
achieves this, ctables
tabulates results.
data list list / patid(f1.0) exposed(a1). begin data 1 "n" 1 "y" 2 "y" 2 "y" 2 "n" 3 "n" 4 "n" 5 "y" 5 "y" 6 "n" 6 "n" end data. sort cases exposed patid. match files file=* /by exposed patid /first=primary. ctables /vlabels variables=primary display=none /table exposed[c] primary[s][validn 'count' sum 'patients'] /categories variables=exposed order=d /titles titl="table1: exposure counts; patients exposed".
Comments
Post a Comment