Crosstabs

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

Crosstabs

alice temu
Dear all,

Happy New Year.

I have a question on
Crosstabs in SPSS
I would like to run one variable (Hb) with two different cutoff points (reference limits)

Limit one: (11g/dl) for pregnant, which can have respondents with Hb >=11g/dl  or <11g/dl.
Limit two:  (12g/dl) for non pregnant, which can also have respondents with Hb >=12g/dl or <12g/dl.

I would like to  see (pregnant and anemic), (pregnant but not anemic),(not pregnantbut anemic), and (not pregnant and not anemic) with their corresponding reference limits in one table (see below).
Is this applicable in SPSS to have frequencies, correlation etc. in such categorical variables? Any alternatives?

Please help.
Thanks,
Alice.


  Anemic Non anemic Total
Pregnant
Non pregnant
Total

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

John Amora
Hi Alice,

To do crosstabs you should have the variables in your data set.  The variables should be in the columns.  In your case, you should have, say, X variable with values pregnant and non pregnant; and Y variable with values anemic and non-anemic.  Suppose you have 5 respondents, your data set should have three columns as follows:

Respondent          X                       Y
A                      pregnant             anemic
B                      nonpregnant        nonanemic
C                      nonpregnant        anemic
D                      pregnant             anemic
E                      pregnant             nonanemic

Then run the following syntax to produce the crosstabs and chisquare statistics:

CROSSTABS
  /TABLES= X BY Y
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

Hope this helps,
Johnny


--- On Tue, 1/6/09, alice temu <[hidden email]> wrote:
From: alice temu <[hidden email]>
Subject: Crosstabs
To: [hidden email]
Date: Tuesday, 6 January, 2009, 10:06 AM

Dear all,

Happy New Year.

I have a question on
Crosstabs in SPSS
I would like to run one variable (Hb) with two different cutoff points
(reference limits)

Limit one: (11g/dl) for pregnant, which can have respondents with Hb
>=11g/dl  or <11g/dl.
Limit two:  (12g/dl) for non pregnant, which can also have respondents with Hb
>=12g/dl or <12g/dl.

I would like to  see (pregnant and anemic), (pregnant but not anemic),(not
pregnantbut anemic), and (not pregnant and not anemic) with their corresponding
reference limits in one table (see below).
Is this applicable in SPSS to have frequencies, correlation etc. in such
categorical variables? Any alternatives?

Please help.
Thanks,
Alice.


  Anemic Non anemic Total
Pregnant
Non pregnant
Total

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



      Catch Emoticarolers in the act in this Christmas! Spread holiday cheers to your friends and loved ones via Yahoo! Messenger today! Get started at http://emoticarolers.com/

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

Johnny Amora
In reply to this post by alice temu
Hi Alice,

To do crosstabs you should have the variables in your
data set.  The variables should be in the columns.  In your case, you
should have, say, X variable with values pregnant and non pregnant; and
Y variable with values anemic and non-anemic.  Suppose you have 5
respondents, your data set should have three columns as follows:

Respondent          X                       Y
A                      pregnant            
 anemic
B                      nonpregnant        nonanemic
C                      nonpregnant        anemic
D                      pregnant             anemic
E                      pregnant             nonanemic

Then run the following syntax to produce the crosstabs and chisquare statistics:

CROSSTABS
  /TABLES= X BY
 Y
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

Hope this helps,
Johnny

--- On Tue, 1/6/09, alice temu <[hidden email]> wrote:
From: alice temu <[hidden email]>
Subject: Crosstabs
To: [hidden email]
Date: Tuesday, 6 January, 2009, 10:06 AM

Dear all,

Happy New Year.

I have a question on
Crosstabs in SPSS
I would like to run one variable (Hb) with two different cutoff points
(reference limits)

Limit one: (11g/dl) for pregnant, which can have respondents with Hb
>=11g/dl  or <11g/dl.
Limit two:  (12g/dl) for non pregnant, which can also have respondents with Hb
>=12g/dl or <12g/dl.

I would like to  see (pregnant and anemic), (pregnant but not anemic),(not
pregnantbut anemic), and (not pregnant and not anemic) with their corresponding
reference limits in one table (see below).
Is this applicable in SPSS to have frequencies, correlation etc. in such
categorical variables? Any alternatives?

Please help.
Thanks,
Alice.


  Anemic Non anemic Total
Pregnant
Non pregnant
Total

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



      Catch Emoticarolers in the act in this Christmas! Spread holiday cheers to your friends and loved ones via Yahoo! Messenger today! Get started at http://emoticarolers.com/

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

alice temu
Dear Jonny,

thanks for your help.
My problem is  giving (computing) the variable Y (from continuous values), a value (based on pregnant and non pregnant references)

Pregnant: < 11, >= 11

Non pregnant:  < 12, >=12

I tried to compute and run frequencies and crosstabs, see below. The values got mixed up. How can I better attempt this test.

Thanks again,
Alice.



IF (((RecPregNow = 0
& hemogl >= 12) | (RecPregNow >= 1 & hemogl >= 11)))
  testheamanpre = 1 .
VARIABLE LABELS
testheamanpre 'test heamoglobin anemia pregnancy' .
EXECUTE .
IF (((RecPregNow = 0
& hemogl  < 12) | (RecPregNow
>= 1 & hemogl  < 11)))
  testheamanpre = 2 .
EXECUTE .

FREQUENCIES
  VARIABLES=testheamanpre
  /STATISTICS=SUM
  /BARCHART  FREQ
  /ORDER=  ANALYSIS .

CROSSTABS
  /TABLES=testheamanpre  BY hamlet
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ CORR
  /CELLS= COUNT ROW COLUMN TOTAL
  /COUNT ROUND CELL .




________________________________
From: Johnny Amora <[hidden email]>
To: [hidden email]
Sent: Monday, January 5, 2009 9:30:02 PM
Subject: Re: Crosstabs

Hi Alice,

To do crosstabs you should have the variables in your
data set.  The variables should be in the columns.  In your case, you
should have, say, X variable with values pregnant and non pregnant; and
Y variable with values anemic and non-anemic.  Suppose you have 5
respondents, your data set should have three columns as follows:


Respondent          X                       Y
A                      pregnant
anemic
B                      nonpregnant        nonanemic
C                      nonpregnant        anemic
D                      pregnant             anemic
E                      pregnant             nonanemic

Then run the following syntax to produce the crosstabs and chisquare statistics:

CROSSTABS
  /TABLES= X BY
Y
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

Hope this helps,
Johnny

--- On Tue, 1/6/09, alice temu <[hidden email]> wrote:
From: alice temu <[hidden email]>
Subject: Crosstabs
To: [hidden email]
Date: Tuesday, 6 January, 2009, 10:06 AM

Dear all,

Happy New Year.

I have a question on
Crosstabs in SPSS
I would like to run one variable (Hb) with two different cutoff points
(reference limits)



I would like to  see (pregnant and anemic), (pregnant but not anemic),(not
pregnantbut anemic), and (not pregnant and not anemic) with their corresponding
reference limits in one table (see below).
Is this applicable in SPSS to have frequencies, correlation etc. in such
categorical variables? Any alternatives?

Please help.
Thanks,
Alice.


  Anemic Non anemic Total
Pregnant
Non pregnant
Total

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



      Catch Emoticarolers in the act in this Christmas! Spread holiday cheers to your friends and loved ones via Yahoo! Messenger today! Get started at http://emoticarolers.com/

====================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
Reply | Threaded
Open this post in threaded view
|

Re: Crosstabs

Maguin, Eugene
Alice,

I understand that you are having trouble but I don't understand what the
trouble is. It looks like the new variable computation executed without
syntax errors. Is it that the new variable has missing values where you
think there shouldn't be missing values? Or, is it that you aren't getting
the kind of output that you want? If the former, please illustrate the
computation with some data. If the latter, please better describe the
output, including defining terms like 'reference limits', meaningful to you
but not to me.

Gene Maguin

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

Bob Schacht-3
In reply to this post by alice temu
At 04:06 PM 1/5/2009, alice temu wrote:

>Dear all,
>
>Happy New Year.
>
>I have a question on
>Crosstabs in SPSS
>I would like to run one variable (Hb) with two different cutoff points
>(reference limits)
>
>Limit one: (11g/dl) for pregnant, which can have respondents with
>Hb >=11g/dl  or <11g/dl.
>Limit two:  (12g/dl) for non pregnant, which can also have respondents
>with Hb >=12g/dl or <12g/dl.
>
>I would like to  see (pregnant and anemic), (pregnant but not anemic),(not
>pregnantbut anemic), and (not pregnant and not anemic) with their
>corresponding reference limits in one table (see below).
>Is this applicable in SPSS to have frequencies, correlation etc. in such
>categorical variables? Any alternatives?
>
>Please help.
>Thanks,
>Alice.

Alice,
If I may take a slightly different tack than the others, may I ask what it
is that you are trying to accomplish?
Are you trying to see if your variables Pregnancy (yes or no) and Anemia
(calibrated) are independent?
If so, why not do an analysis of variance instead?

You might also want to do a graph showing, one on top of the other,
subjects who were pregnant (showing degrees of anemia) and those who were
not pregnant (showing degrees of anemia), with the horizontal axis showing
degree of anemia on the same scale, and the vertical axis showing the
relative frequency.

You might get more useful answers if you tell us what your goal or purpose is.

Bob Schacht



>   Anemic Non anemic Total
>Pregnant
>Non pregnant
>Total
>
>=====================
>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

Robert M. Schacht, Ph.D. <[hidden email]>
Pacific Basin Rehabilitation Research & Training Center
1268 Young Street, Suite #204
Research Center, University of Hawaii
Honolulu, HI 96814

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

alice temu
In reply to this post by alice temu
Dear Johnny, Pat and Mark,

thanks a lot for all your support and contribution.
I tested what Pat suggested and everything worked out just as I wanted. Thank you very much.
Good day.
Alice.



________________________________
From: "Cleland, Patricia (EDU)" <[hidden email]>
To: alice temu <[hidden email]>
Sent: Tuesday, January 6, 2009 2:24:34 PM
Subject: RE: Crosstabs

Have you had any solutions to your problem? If not, here's my solution.

As I understand it, here's the data that you have.  For each
client/subject you have data on their hemoglobin levels ('hemogl') and
whether or not they are pregnant ('RecPregNow'). You've said that the
Hgb is reported as g/dl. Pregnancy is coded either 1 or 0. I'm assuming
the 1 is positive (i.e., pregnant) and 0 is negative (i.e., not
pregnant). If this assumption is wrong please let me know.

The normal values as you've reported them are:
Pregnant: GE 11
Not-pregnant women: GE 12.

Values below these cutoffs indicate anemia.


Here's the table that that gives:

            Hemoglobin Values
RecPregNow        Code    Anemic    Not Anemic
Pregnant        1    <11        =>11 (GE 11)
Not Pregnant    0    <12        =>12 (GE 12)


Am I correct so far? Is your data set restricted to women?

As I understand it, this is what you want:

            Number of Clients/Subjects
RecPregNow        Anemic    Not Anemic
Pregnant
Not Pregnant

Am I correct?

Your basic problem is that crosstabs can't be used with a continuous
variable such as Hgb. You will need to create a new variable which has
only two values, either anemic or not anemic. You've done this below. I
agree with your If statements, the only change that I would make would
be to code the 'not anemic' cases as 0 (negative) and the 'anemic' cases
as 1 (positive).

When I do that using this data set:

CaseID    Hemogl Pregnancy
1        10    1
2        11    0
3        12    1
4        10    0
5        11    1
6        12    0
7        10    1
8        11    0
9        12    1
10        10    0
11        11    1
12        12    0
13        10    1
14        11    0
15        12    1
16        10    0
17        11    1
18        12    0
19        10    1
20        11    0
21        12    1
22        10    0
23        11    1
24        12    0
25        10    1
26        11    0
27        12    1
28        10    0
29        11    1
30        12    0
31        13    1
32        13    1
33        13    0
34        13    1
35        13    1
36        13    0
37        11    1
38        12
39            0

You'll notice that I included 2 cases with missing value as a check.

This is the result I get:

CaseID Hemogl Pregnancy Anemic?
38    12
39            0
4    10        0    2    Anemic
10    10        0    2    Anemic
16    10        0    2    Anemic
22    10        0    2    Anemic
28    10        0    2    Anemic
2    11        0    2    Anemic
8    11        0    2    Anemic
14    11        0    2    Anemic
20    11        0    2    Anemic
26    11        0    2    Anemic
6    12        0    1    Not Anemic
12    12        0    1    Not Anemic
18    12        0    1    Not Anemic
24    12        0    1    Not Anemic
30    12        0    1    Not Anemic
33    13        0    1    Not Anemic
36    13        0    1    Not Anemic
1    10        1    2    Anemic
7    10        1    2    Anemic
13    10        1    2    Anemic
19    10        1    2    Anemic
25    10        1    2    Anemic
5    11        1    1    Not Anemic
11    11        1    1    Not Anemic
17    11        1    1    Not Anemic
23    11        1    1    Not Anemic
29    11        1    1    Not Anemic
37    11        1    1    Not Anemic
3    12        1    1    Not Anemic
9    12        1    1    Not Anemic
15    12        1    1    Not Anemic
21    12        1    1    Not Anemic
27    12        1    1    Not Anemic
31    13        1    1    Not Anemic
32    13        1    1    Not Anemic
34    13        1    1    Not Anemic
35    13        1    1    Not Anemic

You'll notice that cases 38 and 39 which have missing data also have
missing data for anemia.

    Crosstabulation (RecPregNow by Anemic)

                Anemic
            No    Yes    Total
RecPregNow 1 No       7    10    17
         2 Yes    15    5    20
Total            22    15    37

Is this what you wanted? Let me know if there is anything I can do to
help you with this.

In case it helps, here's the syntax that I used:

*check number of pregnant/non-pregnant clients/subjects.
FREQUENCIES VARIABLES= RecPregNow
  /ORDER=ANALYSIS.

*create variable Anemic,
IF ((RecPregNow =0 and hemogl GE 12) OR (RecPregNow =1 and hemogl  GE
11)) Anemic=1.
IF ((RecPregNow =0 and hemogl LT 12) OR (RecPregNow =1 and hemogl  LT
11)) Anemic=2.

FORMATS Anemic (f1).
VARIABLE LABELS  Anemic 'Is client Anemic?'.
VALUE LABELS  Anemic 1 'No' 2 'Yes'.

FREQUENCIES VARIABLES=Anemic
  /ORDER=ANALYSIS.

*use this crosstabs to check your recoding.
CROSSTABS
  /TABLES=hemogl    BY RecPregNow
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.



CROSSTABS
  /TABLES=hemogl   BY Anemic BY RecPregNow
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.

CROSSTABS
  /TABLES=Anemic BY RecPregNow
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.

CROSSTABS
  /TABLES=RecPregNow  BY  Anemic
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.


Pat

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
alice temu
Sent: January 5, 2009 11:50 PM
To: [hidden email]
Subject: Re: Crosstabs

Dear Jonny,

thanks for your help.
My problem is  giving (computing) the variable Y (from continuous
values), a value (based on pregnant and non pregnant references)

Pregnant: < 11, >= 11

Non pregnant:  < 12, >=12

I tried to compute and run frequencies and crosstabs, see below. The
values got mixed up. How can I better attempt this test.

Thanks again,
Alice.



IF (((RecPregNow = 0
& hemogl >= 12) | (RecPregNow >= 1 & hemogl >= 11)))
  testheamanpre = 1 .
VARIABLE LABELS
testheamanpre 'test heamoglobin anemia pregnancy' .
EXECUTE .
IF (((RecPregNow = 0
& hemogl  < 12) | (RecPregNow
>= 1 & hemogl  < 11)))
  testheamanpre = 2 .
EXECUTE .

FREQUENCIES
  VARIABLES=testheamanpre
  /STATISTICS=SUM
  /BARCHART  FREQ
  /ORDER=  ANALYSIS .

CROSSTABS
  /TABLES=testheamanpre  BY hamlet
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ CORR
  /CELLS= COUNT ROW COLUMN TOTAL
  /COUNT ROUND CELL .




________________________________
From: Johnny Amora <[hidden email]>
To: [hidden email]
Sent: Monday, January 5, 2009 9:30:02 PM
Subject: Re: Crosstabs

Hi Alice,

To do crosstabs you should have the variables in your
data set.  The variables should be in the columns.  In your case, you
should have, say, X variable with values pregnant and non pregnant; and
Y variable with values anemic and non-anemic.  Suppose you have 5
respondents, your data set should have three columns as follows:


Respondent          X                       Y
A                      pregnant
anemic
B                      nonpregnant        nonanemic
C                      nonpregnant        anemic
D                      pregnant             anemic
E                      pregnant             nonanemic

Then run the following syntax to produce the crosstabs and chisquare
statistics:

CROSSTABS
  /TABLES= X BY
Y
  /FORMAT= AVALUE TABLES
  /STATISTIC=CHISQ
  /CELLS= COUNT
  /COUNT ROUND CELL .

Hope this helps,
Johnny

--- On Tue, 1/6/09, alice temu <[hidden email]> wrote:
From: alice temu <[hidden email]>
Subject: Crosstabs
To: [hidden email]
Date: Tuesday, 6 January, 2009, 10:06 AM

Dear all,

Happy New Year.

I have a question on
Crosstabs in SPSS
I would like to run one variable (Hb) with two different cutoff points
(reference limits)



I would like to  see (pregnant and anemic), (pregnant but not
anemic),(not
pregnantbut anemic), and (not pregnant and not anemic) with their
corresponding
reference limits in one table (see below).
Is this applicable in SPSS to have frequencies, correlation etc. in such
categorical variables? Any alternatives?

Please help.
Thanks,
Alice.


  Anemic Non anemic Total
Pregnant
Non pregnant
Total

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



      Catch Emoticarolers in the act in this Christmas! Spread holiday
cheers to your friends and loved ones via Yahoo! Messenger today! Get
started at http://emoticarolers.com/

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

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