|
Hi all,
I have a question regarding Ctable in SPSS 18.
When I try to run a tab that combines 2 variables with different statistics ie.
Col % & Mean+std, it shows an extra column to display "mean/ std", this is
quite anoying as I can hardly align it with all other tabs that involve only ONE
variable. This does not happen in SPSS 12. In version 18, if I change the
VISIBLE=NO, then the extra column is removed but the lable "Mean & Std" also
disappear.
Could anyone please advise how to collapse the
extra column (in tab Attribute 1) but the label still
shown.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello Hop, If you are trying to transform a table like:
Then you should add a /SLABELS POSITION=ROW command to your CTABLES syntax. Below I post the syntax I used to generate both tables: DATASET CLOSE ALL. NEW FILE. DATA LIST LIST /V1. BEGIN DATA 10 10 5 6 18 15 5 10 END DATA. EXE. VAR LABEL V1 "AGE". FORMAT V1 (F2.0). CTABLES /VLABELS VARIABLES=V1 DISPLAY=LABEL /TABLE V1 [COLPCT.COUNT PCT40.1, TOTALS[COUNT F40.0, MEAN, STDDEV]] /CATEGORIES VARIABLES=V1 ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES LABEL='Total' POSITION=AFTER MISSING=EXCLUDE. CTABLES /VLABELS VARIABLES=V1 DISPLAY=LABEL /TABLE V1 [C][COLPCT.COUNT PCT40.1, TOTALS[COUNT F40.0, MEAN, STDDEV]] /SLABELS POSITION=ROW /CATEGORIES VARIABLES=V1 ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES LABEL='Total' POSITION=AFTER MISSING=EXCLUDE. If you need something else please post again with more details and possibly some sample syntax you are using. Cheers, Luca R version 2.9.2 (2009-08-24) Mac OS X 10.6.3 (10D573) - kernel Darwin 10.3.0 Il giorno 28/apr/2010, alle ore 15.12, Thien Hop ha scritto:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am rushing thru jobs right now but have you tried the following?
Luca Il giorno 29/apr/2010, alle ore 05.36, Thien Hop ha scritto:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Luca,
I tried it (VISIBLE=NO) & the "Mean
& Standard Deviation" is gone. Anyway, it works when I copy the variable to
temp var for "mean+std" & add Slabel for the primary variable "col %". I
just need to delete the extra column & the label "mean+std" is still
there.
Thanks,
Hop
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In reply to this post by Albert-Jan Roskam
Hello, I would like to get the earliest in and latest out dates among a
set of overlapping periods using syntax. An example is provided below. Could anyone help me with that? Thanks, Asil EXAMPLE: I would like to go from this set
To this set
|
|
Asil,
I might be misunderstanding, but this looks like a straight forward application of Aggregate where you select the min value of Indate and the max value of OutDate. Gene Maguin >>I would like to get the earliest in and latest out dates among a set of overlapping periods using syntax. An example is provided below. Could anyone help me with that? Thanks, Asil EXAMPLE: I would like to go from this set StudyID InDate OutDate 30006 9/20/2002 4/30/2007 30006 12/29/2006 5/31/2012 30006 11/25/2009 5/31/2012 30014 4/16/1975 3/3/1988 30014 4/21/1980 5/28/1982 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 To this set StudyID InDate OutDate 30006 9/20/2002 5/31/2012 30014 4/16/1975 3/3/1988 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 ===================== 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 |
|
Administrator
|
In reply to this post by Asil Ozdogru
Dates are numeric variables, so you can use the MIN and MAX functions of AGGREGATE to pull out the earliest INDATE and latest OUTDATE. If you want the same variable names as in the original data, you'll have to set the OVERWRITE option to yes.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
In reply to this post by Maguin, Eugene
Gene:
The problem set includes overlapping and non-overlapping intervals-- case 3006 goes from three to one record, while case 30057 has three non-overlapping intervals. Asil: Here is a solution. ** Sample data. NEW FILE. DATA LIST FREE/StudyID (f8.0) InDate (ADATE10) OutDate (ADATE10). BEGIN DATA 30006 09/20/2002 04/30/2007 30006 12/29/2006 05/31/2012 30006 11/25/2009 05/31/2012 30014 04/16/1975 03/03/1988 30014 04/21/1980 05/28/1982 30014 02/16/2001 11/24/2001 30022 02/05/1992 07/22/1995 30057 02/01/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 01/23/1992 10/18/1993 END DATA. DATASET NAME intervals WINDOW = FRONT. ** optional if live data is presorted. SORT CASES BY studyID indate (A). ** Identify overlapping periods. COMPUTE sequence = 1. IF studyid = LAG(studyid) AND indate LE LAG(outdate) sequence = LAG(sequence) + 1. ** create a variable to identify the start of a new overlapping period. COMPUTE seq_start = sequence = 1. ** create a variable to number each new set of overlapping periods-- ** needed to aggregate data. FILTER BY seq_start. RANK indate BY studyID / RANK INTO intervals. FILTER OFF. ** transfer the number for each new overlapping period ** down to each case in the overlapping period. NUMERIC #seq (F8.0). DO IF seq_start. . COMPUTE #seq = intervals. ELSE . . COMPUTE intervals = #seq. END IF . EXECUTE . DATASET DECLARE final_data. AGGREGATE OUTFILE = final_data /BREAK = studyID intervals /indate = MIN(indate) /outdate = MAX(indate). DATASET ACTIVATE final_data. LIST. Jim Marks Director, Market Research x1616 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin Sent: Wednesday, May 12, 2010 1:33 PM To: [hidden email] Subject: Re: Overlapping Periods Asil, I might be misunderstanding, but this looks like a straight forward application of Aggregate where you select the min value of Indate and the max value of OutDate. Gene Maguin >>I would like to get the earliest in and latest out dates among a set of overlapping periods using syntax. An example is provided below. Could anyone help me with that? Thanks, Asil EXAMPLE: I would like to go from this set StudyID InDate OutDate 30006 9/20/2002 4/30/2007 30006 12/29/2006 5/31/2012 30006 11/25/2009 5/31/2012 30014 4/16/1975 3/3/1988 30014 4/21/1980 5/28/1982 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 To this set StudyID InDate OutDate 30006 9/20/2002 5/31/2012 30014 4/16/1975 3/3/1988 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 ===================== 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 |
|
Jim,
Thank you for pointing out my error. The code I posted doesn't yield the sample output. After studying Asil's imput and output this morning, I realize that I didn't understand the problem that Asil had posed. Gene Maguin Gene: The problem set includes overlapping and non-overlapping intervals-- case 3006 goes from three to one record, while case 30057 has three non-overlapping intervals. Asil: Here is a solution. ** Sample data. NEW FILE. DATA LIST FREE/StudyID (f8.0) InDate (ADATE10) OutDate (ADATE10). BEGIN DATA 30006 09/20/2002 04/30/2007 30006 12/29/2006 05/31/2012 30006 11/25/2009 05/31/2012 30014 04/16/1975 03/03/1988 30014 04/21/1980 05/28/1982 30014 02/16/2001 11/24/2001 30022 02/05/1992 07/22/1995 30057 02/01/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 01/23/1992 10/18/1993 END DATA. DATASET NAME intervals WINDOW = FRONT. ** optional if live data is presorted. SORT CASES BY studyID indate (A). ** Identify overlapping periods. COMPUTE sequence = 1. IF studyid = LAG(studyid) AND indate LE LAG(outdate) sequence = LAG(sequence) + 1. ** create a variable to identify the start of a new overlapping period. COMPUTE seq_start = sequence = 1. ** create a variable to number each new set of overlapping periods-- ** needed to aggregate data. FILTER BY seq_start. RANK indate BY studyID / RANK INTO intervals. FILTER OFF. ** transfer the number for each new overlapping period ** down to each case in the overlapping period. NUMERIC #seq (F8.0). DO IF seq_start. . COMPUTE #seq = intervals. ELSE . . COMPUTE intervals = #seq. END IF . EXECUTE . DATASET DECLARE final_data. AGGREGATE OUTFILE = final_data /BREAK = studyID intervals /indate = MIN(indate) /outdate = MAX(indate). DATASET ACTIVATE final_data. LIST. Jim Marks Director, Market Research x1616 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin Sent: Wednesday, May 12, 2010 1:33 PM To: [hidden email] Subject: Re: Overlapping Periods Asil, I might be misunderstanding, but this looks like a straight forward application of Aggregate where you select the min value of Indate and the max value of OutDate. Gene Maguin >>I would like to get the earliest in and latest out dates among a set of overlapping periods using syntax. An example is provided below. Could anyone help me with that? Thanks, Asil EXAMPLE: I would like to go from this set StudyID InDate OutDate 30006 9/20/2002 4/30/2007 30006 12/29/2006 5/31/2012 30006 11/25/2009 5/31/2012 30014 4/16/1975 3/3/1988 30014 4/21/1980 5/28/1982 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 To this set StudyID InDate OutDate 30006 9/20/2002 5/31/2012 30014 4/16/1975 3/3/1988 30014 2/16/2001 11/24/2001 30022 2/5/1992 7/22/1995 30057 2/1/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 1/23/1992 10/18/1993 ===================== 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 |
|
Administrator
|
And since I proposed the same solution as Gene...ditto!
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
|
Since I need similar syntax to assess multiple psychiatric
hospitalizations within multiple episodes of care, I was particularly interested in this thread. When I ran the syntax, my output was: StudyID intervals indate outdate 30006 1.000 09/20/2002 11/25/2009 30014 1.000 04/16/1975 04/21/1980 30014 2.000 02/16/2001 02/16/2001 30022 1.000 02/05/1992 02/05/1992 30057 1.000 02/01/1988 02/01/1988 30057 2.000 12/15/1989 12/15/1989 30057 3.000 01/23/1992 01/23/1992 I don't think the syntax solves the problem yet. Brian -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver Sent: Thursday, May 13, 2010 10:22 AM To: [hidden email] Subject: Re: Overlapping Periods Gene Maguin wrote: > > Jim, > > Thank you for pointing out my error. The code I posted doesn't yield the > sample output. After studying Asil's imput and output this morning, I > realize that I didn't understand the problem that Asil had posed. > > Gene Maguin > > And since I proposed the same solution as Gene...ditto! ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://old.nabble.com/Missing-dates--tp17760957p28548166.html Sent from the SPSSX Discussion mailing list archive at Nabble.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 |
|
Oops! I used indate for the outdate in the aggregate. (Thanks, Brian).
** CORRECTED. Here is a solution. ** Sample data. NEW FILE. DATA LIST FREE/StudyID (f8.0) InDate (ADATE10) OutDate (ADATE10). BEGIN DATA 30006 09/20/2002 04/30/2007 30006 12/29/2006 05/31/2012 30006 11/25/2009 05/31/2012 30014 04/16/1975 03/03/1988 30014 04/21/1980 05/28/1982 30014 02/16/2001 11/24/2001 30022 02/05/1992 07/22/1995 30057 02/01/1988 11/20/1988 30057 12/15/1989 10/17/1990 30057 01/23/1992 10/18/1993 END DATA. DATASET NAME intervals WINDOW = FRONT. ** optional if live data is presorted. SORT CASES BY studyID indate (A). ** Identify overlapping periods. COMPUTE sequence = 1. IF studyid = LAG(studyid) AND indate LE LAG(outdate) sequence = LAG(sequence) + 1. ** create a variable to identify the start of a new overlapping period. COMPUTE seq_start = sequence = 1. ** create a variable to number each new set of overlapping periods-- ** needed to aggregate data. FILTER BY seq_start. RANK indate BY studyID / RANK INTO intervals. FILTER OFF. ** transfer the number for each new overlapping period ** down to each case in the overlapping period. NUMERIC #seq (F8.0). DO IF seq_start. . COMPUTE #seq = intervals. ELSE . . COMPUTE intervals = #seq. END IF . EXECUTE . DATASET DECLARE final_data. AGGREGATE OUTFILE = final_data /BREAK = studyID intervals /indate = MIN(indate) /outdate = MAX(outdate). DATASET ACTIVATE final_data. LIST. Jim Marks Director, Market Research x1616 -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Dates, Brian Sent: Thursday, May 13, 2010 10:22 AM To: [hidden email] Subject: Re: Overlapping Periods Since I need similar syntax to assess multiple psychiatric hospitalizations within multiple episodes of care, I was particularly interested in this thread. When I ran the syntax, my output was: StudyID intervals indate outdate 30006 1.000 09/20/2002 11/25/2009 30014 1.000 04/16/1975 04/21/1980 30014 2.000 02/16/2001 02/16/2001 30022 1.000 02/05/1992 02/05/1992 30057 1.000 02/01/1988 02/01/1988 30057 2.000 12/15/1989 12/15/1989 30057 3.000 01/23/1992 01/23/1992 I don't think the syntax solves the problem yet. Brian -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Bruce Weaver Sent: Thursday, May 13, 2010 10:22 AM To: [hidden email] Subject: Re: Overlapping Periods Gene Maguin wrote: > > Jim, > > Thank you for pointing out my error. The code I posted doesn't yield the > sample output. After studying Asil's imput and output this morning, I > realize that I didn't understand the problem that Asil had posed. > > Gene Maguin > > And since I proposed the same solution as Gene...ditto! ----- -- Bruce Weaver [hidden email] http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." NOTE: My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. -- View this message in context: http://old.nabble.com/Missing-dates--tp17760957p28548166.html Sent from the SPSSX Discussion mailing list archive at Nabble.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 |
| Free forum by Nabble | Edit this page |
