|
Dear co-listers. Im trying to do a table that have several levels. The
table will show: the number of deaths and discharges (hospital patients) by diagnosis and age ranks. I want to put a subtotal under each diagnosis, but the base has like 2 thousand different diagnosis. Do I have to put all the subtotals one by one? Or there is any other way or procedure that I can use? Thanks. ___________________________ Rodrigo Briceño Project Manager <http://www.sanigest.com> www.sanigest.com Costa Rica Cell: (506) 886-1177 Fax:(506) 232-0830 Office: 291-1200, ext.129 MSN: <mailto:[hidden email]> [hidden email] SKYPE: rbriceno1087 ____________________________ |
|
At 12:33 PM 6/26/2007, Rodrigo Briceno wrote:
>I'm trying to do a table that have several levels. The table will >show: the number of deaths and discharges (hospital patients) by >diagnosis and age ranks. I want to put a subtotal under each >diagnosis, but the base has like 2 thousand different diagnosis. Do I >have to put all the subtotals one by one? Or there is any other way or >procedure that I can use? I can't help with the syntax for the tables - indeed, I'm not sure what you want to do. But to get the subtotal counts for each diagnosis is an easy exercise in AGGREGATE: AGGREGATE OUTFILE=* /BREAK = Dx /N_Dx 'Number of cases for Dx group' = N. Now, that gives you a file with one record for each diagnosis group, with the count. You probably want this subtotal somewhere combined with other information from your file; but anyway, this is a place to start. |
|
Rodrigo,
Richard's idea may make sense since a TABLE with more than 2000 diagnoses, each broken down by age groups, since a bit cumbersome to manage. You may actually want to have a file with the totals for each diagnosis in each row. You may even have all the age groups in the same row. Now, if what you really want is tables, you may want to have SEPARATE tables for each diagnosis, or group of similar diagnoses. Suppose you have a group of diseases, A, with diagnoses A1, A2, ... Ak, where k is a small number (possibly less than 20). You may generate a single table for this family of medical conditions, with a diagnosis in each row, two big columns (one for deaths, another for discharges) each split into with several sub-columns for age groups. This would generate a certain number of manageable tables concerning groups of related illnesses. Otherwise you would produce a single big table the size of a bed sheet, very difficult to read and manage. You may also produce, as a supplement, a summary table with totals by broad medical condition, showing only death and discharges in the columns without the age groups. I imagine the 2000 diagnoses may be grouped in a much smaller number of broad medical conditions. In either case, the CTABLES or TABLES commands would produce the tables quite readily. Perhaps if you clarify what you really want we may give a more definite advice. Hector -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow Sent: 03 July 2007 01:15 To: [hidden email] Subject: Re: subtotals in SPSS At 12:33 PM 6/26/2007, Rodrigo Briceno wrote: >I'm trying to do a table that have several levels. The table will >show: the number of deaths and discharges (hospital patients) by >diagnosis and age ranks. I want to put a subtotal under each >diagnosis, but the base has like 2 thousand different diagnosis. Do I >have to put all the subtotals one by one? Or there is any other way or >procedure that I can use? I can't help with the syntax for the tables - indeed, I'm not sure what you want to do. But to get the subtotal counts for each diagnosis is an easy exercise in AGGREGATE: AGGREGATE OUTFILE=* /BREAK = Dx /N_Dx 'Number of cases for Dx group' = N. Now, that gives you a file with one record for each diagnosis group, with the count. You probably want this subtotal somewhere combined with other information from your file; but anyway, this is a place to start. |
|
In reply to this post by Rodrigo Briceño
I'm also a little unclear exactly what you want to do. However, it sounds
like you want an extra 'grouping' variable that combines several diagnoses and subtotal only as the group changes, for example a major diagnostic category of orthopaedics would include diagnosis of various bone and joint problems. If this is what you want to do, one method is to create a new variable with the RECODE procedure. Then, you can use SPLIT FILE and LAYERED BY (or compare groups if using menus) on your new variable. Note that you will need to SORT by the new variable before splitting. Cheers, Jen At 12:33 PM 6/26/2007, Rodrigo Briceno wrote: >I'm trying to do a table that have several levels. The table will >show: the number of deaths and discharges (hospital patients) by >diagnosis and age ranks. I want to put a subtotal under each diagnosis, >but the base has like 2 thousand different diagnosis. Do I have to put >all the subtotals one by one? Or there is any other way or procedure >that I can use? |
|
It sounds like what you want is easily done with Custom Tables. Here is an example with nested totals in the rows.
CTABLES /TABLE origin > year [COUNT] /CATEGORIES VARIABLES=origin year EMPTY=EXCLUDE TOTAL=YES. This gives subtotals for all values of year within origin as well as the outer totals. (You can pick which variables get the totals.) HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jen Badham Sent: Wednesday, July 04, 2007 12:08 AM To: [hidden email] Subject: Re: [SPSSX-L] subtotals in SPSS I'm also a little unclear exactly what you want to do. However, it sounds like you want an extra 'grouping' variable that combines several diagnoses and subtotal only as the group changes, for example a major diagnostic category of orthopaedics would include diagnosis of various bone and joint problems. If this is what you want to do, one method is to create a new variable with the RECODE procedure. Then, you can use SPLIT FILE and LAYERED BY (or compare groups if using menus) on your new variable. Note that you will need to SORT by the new variable before splitting. Cheers, Jen At 12:33 PM 6/26/2007, Rodrigo Briceno wrote: >I'm trying to do a table that have several levels. The table will >show: the number of deaths and discharges (hospital patients) by >diagnosis and age ranks. I want to put a subtotal under each diagnosis, >but the base has like 2 thousand different diagnosis. Do I have to put >all the subtotals one by one? Or there is any other way or procedure >that I can use? |
| Free forum by Nabble | Edit this page |
