creating Tables

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

creating Tables

Lacay, Phebe
Hi All,

 

I want to create a table with multiple levels based on ranges

For example

 

I have the following sample data:

 

Group   gpa       credit

1          1.25      10.00

1          2.29      24.00

1          3.34      13.00

2          2.88      31.00

2          3.10      31.00

2          3.14      42.00

2          3.21      46.00

 

 

I want a table that breaks on each group and counts the gpa by credit
into ranges for each category

 

For example the output should look something like this

 

Group 1  

                         CreditRange

gpaRange           1-12     13-24    25-36

1.0   -2.0             1

2.1- 3.0                         1

3.1- 4.0             1                      

 

Group 2

                        credit

gpa                    1-12     13-24    25-36

1.0 -2.0            

2.1- 3.0                                     1

3.1- 4.0                                     3          

 

 

Can someone please let me know if I am on the right track.

I started by creating a range into a different variable for gpa and
credit (see below).  I am not sure if this is a necessary step.  From
there I believe I should be using the Tables tab, but am not sure which
one.  I am not too familiar with syntax but I use Windows and paste the
syntax to keep a record, so either method of response works for me.

 

STRING gpaRange (A10) .

RECODE

  gpa

  (0 thru .5='0-.5')  (0.51 thru 1='.51-1')  (1.01 thru
1.50='1.01-1.50')  (1.51 thru 1.75='1.51-1.75')  (1.76 thru 2.00='1.76'+

 '-2.00')  (2.01 thru 2.29='2.01-2.29')  (2.30 thru 2.69='2.30-2.69')
(2.70 thru 3.00='2.70-3.00')  (3.01 thru 3.29='3.01'+

 '-3.29')  (3.30 thru 3.69='3.30-3.69')  (3.70 thru 4.00='3.70-4.00')
(4.01 thru 4.30='4.01-4.30')  INTO  gpaRange .

EXECUTE .

 

RECODE

  credits

  (0 thru 12='0-12')  (13 thru 24='13-24')  (25 thru 36='25-36')  (37
thru 48='37-48')  (49 thru 60='49-60')  (61 thru 72='61'+

 '-72')  (73 thru 84='73-84')  (85 thru 96='85-96')  (97 thru
108='97-108')  (109 thru 120='109-120')  (121 thru 999='121+')

  INTO  creditRange .

EXECUTE .

 

 

 

Thanks in advance,

Phebe

 

 

====================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: creating Tables

Edward Boadi
The following syntax will generate the require table for you (you  may
have to edit the syntax).

CTABLES
  /VLABELS VARIABLES=gpaRange Group gpaRange DISPLAY=DEFAULT
  /TABLE Group > gpaRange [COUNT F40.0] BY CreditRange
  /CATEGORIES VARIABLES=CreditRange ORDER=A KEY=VALUE EMPTY=INCLUDE
  /CATEGORIES VARIABLES=Group ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES
POSITION=AFTER
  /CATEGORIES VARIABLES=gpaRange  ORDER=A KEY=VALUE EMPTY=EXCLUDE.

Thanks
Edward.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Lacay, Phebe
Sent: Friday, October 19, 2007 11:48 AM
To: [hidden email]
Subject: creating Tables


Hi All,



I want to create a table with multiple levels based on ranges

For example



I have the following sample data:



Group   gpa       credit

1          1.25      10.00

1          2.29      24.00

1          3.34      13.00

2          2.88      31.00

2          3.10      31.00

2          3.14      42.00

2          3.21      46.00





I want a table that breaks on each group and counts the gpa by credit
into ranges for each category



For example the output should look something like this



Group 1

                         CreditRange

gpaRange           1-12     13-24    25-36

1.0   -2.0             1

2.1- 3.0                         1

3.1- 4.0             1



Group 2

                        credit

gpa                    1-12     13-24    25-36

1.0 -2.0

2.1- 3.0                                     1

3.1- 4.0                                     3





Can someone please let me know if I am on the right track.

I started by creating a range into a different variable for gpa and
credit (see below).  I am not sure if this is a necessary step.  From
there I believe I should be using the Tables tab, but am not sure which
one.  I am not too familiar with syntax but I use Windows and paste the
syntax to keep a record, so either method of response works for me.



STRING gpaRange (A10) .

RECODE

  gpa

  (0 thru .5='0-.5')  (0.51 thru 1='.51-1')  (1.01 thru
1.50='1.01-1.50')  (1.51 thru 1.75='1.51-1.75')  (1.76 thru 2.00='1.76'+

 '-2.00')  (2.01 thru 2.29='2.01-2.29')  (2.30 thru 2.69='2.30-2.69')
(2.70 thru 3.00='2.70-3.00')  (3.01 thru 3.29='3.01'+

 '-3.29')  (3.30 thru 3.69='3.30-3.69')  (3.70 thru 4.00='3.70-4.00')
(4.01 thru 4.30='4.01-4.30')  INTO  gpaRange .

EXECUTE .



RECODE

  credits

  (0 thru 12='0-12')  (13 thru 24='13-24')  (25 thru 36='25-36')  (37
thru 48='37-48')  (49 thru 60='49-60')  (61 thru 72='61'+

 '-72')  (73 thru 84='73-84')  (85 thru 96='85-96')  (97 thru
108='97-108')  (109 thru 120='109-120')  (121 thru 999='121+')

  INTO  creditRange .

EXECUTE .







Thanks in advance,

Phebe





=======
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: creating Tables

ViAnn Beadle
In reply to this post by Lacay, Phebe
Since you've created your gpa ranges and credit ranges, you can just run
CROSSTABS or TABLES. If you want entirely separate tables for each group,
you'll have to split the file and specify the SEPARATE keyword (UI radio
button in the Split File dialog is "Organize output by Groups").

1. Groups within the same table option. Within the CROSSTABS UI creditrange
is the column variable and gparange is the row variable. Group is the layer
variable and create the left outermost row in the table. The default
statistic is count:

CROSSTABS /TABLES = creditrange by gparange by group.

2. Separate tables by group option:

SORT CASES BY group.
SPLIT FILE SEPARATE BY group.
CROSSTABS /TABLES = creditrange by gparange.

Note that you also need to declare the creditrange string variable just as
you have declared the gparange string variable in your syntax below.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Lacay, Phebe
Sent: Friday, October 19, 2007 9:48 AM
To: [hidden email]
Subject: creating Tables

Hi All,



I want to create a table with multiple levels based on ranges

For example



I have the following sample data:



Group   gpa       credit

1          1.25      10.00

1          2.29      24.00

1          3.34      13.00

2          2.88      31.00

2          3.10      31.00

2          3.14      42.00

2          3.21      46.00





I want a table that breaks on each group and counts the gpa by credit
into ranges for each category



For example the output should look something like this



Group 1

                         CreditRange

gpaRange           1-12     13-24    25-36

1.0   -2.0             1

2.1- 3.0                         1

3.1- 4.0             1



Group 2

                        credit

gpa                    1-12     13-24    25-36

1.0 -2.0

2.1- 3.0                                     1

3.1- 4.0                                     3





Can someone please let me know if I am on the right track.

I started by creating a range into a different variable for gpa and
credit (see below).  I am not sure if this is a necessary step.  From
there I believe I should be using the Tables tab, but am not sure which
one.  I am not too familiar with syntax but I use Windows and paste the
syntax to keep a record, so either method of response works for me.



STRING gpaRange (A10) .

RECODE

  gpa

  (0 thru .5='0-.5')  (0.51 thru 1='.51-1')  (1.01 thru
1.50='1.01-1.50')  (1.51 thru 1.75='1.51-1.75')  (1.76 thru 2.00='1.76'+

 '-2.00')  (2.01 thru 2.29='2.01-2.29')  (2.30 thru 2.69='2.30-2.69')
(2.70 thru 3.00='2.70-3.00')  (3.01 thru 3.29='3.01'+

 '-3.29')  (3.30 thru 3.69='3.30-3.69')  (3.70 thru 4.00='3.70-4.00')
(4.01 thru 4.30='4.01-4.30')  INTO  gpaRange .

EXECUTE .



RECODE

  credits

  (0 thru 12='0-12')  (13 thru 24='13-24')  (25 thru 36='25-36')  (37
thru 48='37-48')  (49 thru 60='49-60')  (61 thru 72='61'+

 '-72')  (73 thru 84='73-84')  (85 thru 96='85-96')  (97 thru
108='97-108')  (109 thru 120='109-120')  (121 thru 999='121+')

  INTO  creditRange .

EXECUTE .







Thanks in advance,

Phebe





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