|
Hi all,
Anyone know of a quick solution for this problem? Date is entered as a variable as dd/mm/yyyy, but for some reason the dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of dd/mm/2001, so on. Anyone know of an easy way to fix this problem? Thanks! Kevin |
|
Kevin,
Check Edit--Options-->Data tab under Set Century Range for 2-Digit years (mine is the default Automatic 1938-2037--if you have Custom checked, that may be related to what you are seeing Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of KEVIN MANNING Sent: Thursday, June 28, 2007 2:48 PM To: [hidden email] Subject: [SPSSX-L] Quick solution for a date problem? Hi all, Anyone know of a quick solution for this problem? Date is entered as a variable as dd/mm/yyyy, but for some reason the dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of dd/mm/2001, so on. Anyone know of an easy way to fix this problem? Thanks! Kevin PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
|
In reply to this post by KEVIN MANNING
Well, if dates are really entered with unambiguous 4-digit years, that is indeed mysterious. If, however, dates are entered with 2-digit years, you might want to check the SET EPOCH setting, which defines the 100 year span for dates entered with 2-digit year values.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of KEVIN MANNING Sent: Thursday, June 28, 2007 2:48 PM To: [hidden email] Subject: Quick solution for a date problem? Hi all, Anyone know of a quick solution for this problem? Date is entered as a variable as dd/mm/yyyy, but for some reason the dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of dd/mm/2001, so on. Anyone know of an easy way to fix this problem? Thanks! Kevin |
|
In reply to this post by KEVIN MANNING
At 03:48 PM 6/28/2007, KEVIN MANNING wrote:
>Date is entered as a variable as dd/mm/yyyy, but for some reason the >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? See Richard Oliver's reply, but you can see that he's a bit mystified, too. As general advice: When you aren't getting the result you want, it helps if you can give us the exact syntax that seems not to be working; some test data, with some input you passed to the syntax; and the output from that data and the syntax, with any error or warning messages exactly as they were printed. And, what output you wanted instead of the output you got. The more we know, the more we can help. And debugging is like proofreading, or medical diagnosis: It's the details, and the exact information, that matter. -Good luck, and by all means give us a follow-up post, Richard |
|
Thank you. Unfortunately, I do not have any additional syntax or output; this data was entered by a student of a colleague (and the student is no longer here). So I am not sure if the student actually entered the dates "1902" (all four digits) or what, but the dates should range from 1998-2002. We have checked the options for the century as you have specified, no luck. Regardless, thanks for your help.
Kevin ----- Original Message ----- From: Richard Ristow <[hidden email]> Date: Thursday, June 28, 2007 10:16 pm Subject: Re: Quick solution for a date problem? To: KEVIN MANNING <[hidden email]>, [hidden email] Cc: "Oliver, Richard" <[hidden email]>, Melissa Ives <[hidden email]> > At 03:48 PM 6/28/2007, KEVIN MANNING wrote: > > >Date is entered as a variable as dd/mm/yyyy, but for some reason the > > >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of > > >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? > > See Richard Oliver's reply, but you can see that he's a bit mystified, > > too. > > As general advice: When you aren't getting the result you want, it > helps if you can give us the exact syntax that seems not to be > working; > some test data, with some input you passed to the syntax; and the > output from that data and the syntax, with any error or warning > messages exactly as they were printed. And, what output you wanted > instead of the output you got. > > The more we know, the more we can help. And debugging is like > proofreading, or medical diagnosis: It's the details, and the exact > information, that matter. > > -Good luck, and by all means give us a follow-up post, > Richard |
|
In reply to this post by KEVIN MANNING
So how about just adding the 100 years?
In the syntax below, it prevents adding 100 years to any date that is more than 1/1/1908 (you could use any date that makes sense with your data. if (testdt<date.mdy(1,1,1908)) testdt=datesum(testdt,100,"YEAR"). Melissa -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of KEVIN MANNING Sent: Friday, June 29, 2007 7:30 AM To: [hidden email] Subject: Re: [SPSSX-L] Quick solution for a date problem? Thank you. Unfortunately, I do not have any additional syntax or output; this data was entered by a student of a colleague (and the student is no longer here). So I am not sure if the student actually entered the dates "1902" (all four digits) or what, but the dates should range from 1998-2002. We have checked the options for the century as you have specified, no luck. Regardless, thanks for your help. Kevin ----- Original Message ----- From: Richard Ristow <[hidden email]> Date: Thursday, June 28, 2007 10:16 pm Subject: Re: Quick solution for a date problem? To: KEVIN MANNING <[hidden email]>, [hidden email] Cc: "Oliver, Richard" <[hidden email]>, Melissa Ives <[hidden email]> > At 03:48 PM 6/28/2007, KEVIN MANNING wrote: > > >Date is entered as a variable as dd/mm/yyyy, but for some reason the > > >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of > > >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? > > See Richard Oliver's reply, but you can see that he's a bit mystified, > > too. > > As general advice: When you aren't getting the result you want, it > helps if you can give us the exact syntax that seems not to be > working; some test data, with some input you passed to the syntax; and > the output from that data and the syntax, with any error or warning > messages exactly as they were printed. And, what output you wanted > instead of the output you got. > > The more we know, the more we can help. And debugging is like > proofreading, or medical diagnosis: It's the details, and the exact > information, that matter. > > -Good luck, and by all means give us a follow-up post, > Richard PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any attachments may contain PRIVILEGED AND CONFIDENTIAL information and is intended only for the use of the addressee. If you are not the designated recipient, or an employee or agent authorized to deliver such transmittals to the designated recipient, you are hereby notified that any dissemination, copying or publication of this transmittal is strictly prohibited. If you have received this transmittal in error, please notify us immediately by replying to the sender and delete this copy from your system. You may also call us at (309) 827-6026 for assistance. |
|
Thank you. Am I making an error here? Output error message is not reading date sum?
"DOB" is my date variable. if (dob<date.mdy(1,1,1908)) dob=datesum(dob,100,"YEAR"). >Error # 4032 in column 33. Text: datesum >The CTIME, DATE, TIME and XDATE functions, as well as CDF, IDF, NCDF, NPDF, >PDF, and RV functions require a function modifier. None was found. >This command not executed. ----- Original Message ----- From: Melissa Ives <[hidden email]> Date: Friday, June 29, 2007 9:17 am Subject: RE: Re: [SPSSX-L] Quick solution for a date problem? To: KEVIN MANNING <[hidden email]>, [hidden email] > So how about just adding the 100 years? > In the syntax below, it prevents adding 100 years to any date that is > more than 1/1/1908 (you could use any date that makes sense with your > data. > > if (testdt<date.mdy(1,1,1908)) testdt=datesum(testdt,100,"YEAR"). > > Melissa > > -----Original Message----- > From: SPSSX(r) Discussion [ On Behalf Of > KEVIN MANNING > Sent: Friday, June 29, 2007 7:30 AM > To: [hidden email] > Subject: Re: [SPSSX-L] Quick solution for a date problem? > > Thank you. Unfortunately, I do not have any additional syntax or > output; this data was entered by a student of a colleague (and the > student is no longer here). So I am not sure if the student actually > entered the dates "1902" (all four digits) or what, but the dates should > range from 1998-2002. We have checked the options for the century as > you have specified, no luck. Regardless, thanks for your help. > Kevin > > > > ----- Original Message ----- > From: Richard Ristow <[hidden email]> > Date: Thursday, June 28, 2007 10:16 pm > Subject: Re: Quick solution for a date problem? > To: KEVIN MANNING <[hidden email]>, [hidden email] > Cc: "Oliver, Richard" <[hidden email]>, Melissa Ives > <[hidden email]> > > > > At 03:48 PM 6/28/2007, KEVIN MANNING wrote: > > > > >Date is entered as a variable as dd/mm/yyyy, but for some reason the > > > > >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead of > > > > >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? > > > > See Richard Oliver's reply, but you can see that he's a bit mystified, > > > > too. > > > > As general advice: When you aren't getting the result you want, it > > helps if you can give us the exact syntax that seems not to be > > working; some test data, with some input you passed to the syntax; and > > > the output from that data and the syntax, with any error or warning > > > messages exactly as they were printed. And, what output you wanted > > instead of the output you got. > > > > The more we know, the more we can help. And debugging is like > > proofreading, or medical diagnosis: It's the details, and the exact > > > information, that matter. > > > > -Good luck, and by all means give us a follow-up post, > > Richard > > > PRIVILEGED AND CONFIDENTIAL INFORMATION > This transmittal and any attachments may contain PRIVILEGED AND > CONFIDENTIAL information and is intended only for the use of the > addressee. If you are not the designated recipient, or an employee > or agent authorized to deliver such transmittals to the designated > recipient, you are hereby notified that any dissemination, > copying or publication of this transmittal is strictly prohibited. If > you have received this transmittal in error, please notify us > immediately by replying to the sender and delete this copy from your > system. You may also call us at (309) 827-6026 for assistance. |
|
In reply to this post by KEVIN MANNING
At 08:29 AM 6/29/2007, KEVIN MANNING wrote:
>This data was entered by a student of a colleague (and the student is >no longer here). So I am not sure if the student actually entered the >dates "1902" (all four digits) or what, but the dates should range >from 1998-2002. We have checked the options for the century as you >have specified, no luck. Regardless, thanks for your help. Ah! You described the problem as, >>Date is entered as a variable as dd/mm/yyyy, but for some reason the >>dates for 2000+ are reading as dd/mm/1901, dd/mm/1902 but that appears not to be the problem you have. your problem is that certain of your dates (which I assume are SPSS date variables - please tell us, if that is NOT so) are wrong, apparently by 100 years. There's no way of telling how it happened. Since you asked about a problem reading certain input, of course we responded about reading dates from input. In fact (if I read you correctly, today), you don't have the input, and your problem is that error in some of your date values. Melissa's solution is the right one: if a date is in the range 1898-1902, add the 100 years that it is apparently off. If a date is neither in the correct range, nor in the correct range minus 100 years, look at it with suspicion. The moral, of course, is to state your problem as you HAVE it (your question of today), not as you INTERPRET it ("Date is entered as a variable as dd/mm/yyyy, but the dates for 2000+ are reading as dd/mm/1901, dd/mm/1902"). We'd have got your answer a lot quicker, if we'd known. -Best of luck, Richard Ristow |
|
In reply to this post by KEVIN MANNING
At 09:33 AM 6/29/2007, KEVIN MANNING wrote:
>Thank you. Am I making an error here? Output error message is not >reading date sum? > >"DOB" is my date variable. > >if (dob<date.mdy(1,1,1908)) dob=datesum(dob,100,"YEAR"). > >>Error # 4032 in column 33. Text: datesum You may have an SPSS release from before DATESUM was added (I think it was in SPSS 14). So you need the same effect, by a somewhat longer route. Code not tested, and note use of scratch variables: COMPUTE #DOB.MON = XDATE.MONTH(dob). COMPUTE #DOB.DAY = XDATE.DAY (dob). COMPUTE #DOB.YR = XDATE.YR (dob). IF #DOB.YR LE 1999 #DOB.YR = #DOB.YR + 100. COMPUTE dob = DATE.MDY(#DOB.MON,#DOB.DAY,#DOB.YR). |
|
In reply to this post by KEVIN MANNING
That works fine for me. What version of SPSS are you using? It is
having trouble with column 33 which is the = sign after dob. Does the version you are using have the option for DATESUM? If not you could break the date down and add 100 that way. if (dob<date.mdy(1,1,1908)) dob=date.mdy(xdate.month(dob),xdate.mday(dob),(xdate.year(dob)+100)). Melissa -----Original Message----- From: KEVIN MANNING [mailto:[hidden email]] Sent: Friday, June 29, 2007 8:34 AM To: Melissa Ives Cc: [hidden email] Subject: Re: RE: Re: [SPSSX-L] Quick solution for a date problem? Thank you. Am I making an error here? Output error message is not reading date sum? "DOB" is my date variable. if (dob<date.mdy(1,1,1908)) dob=datesum(dob,100,"YEAR"). >Error # 4032 in column 33. Text: datesum The CTIME, DATE, TIME and >XDATE functions, as well as CDF, IDF, NCDF, NPDF, PDF, and RV functions >require a function modifier. None was found. >This command not executed. ----- Original Message ----- From: Melissa Ives <[hidden email]> Date: Friday, June 29, 2007 9:17 am Subject: RE: Re: [SPSSX-L] Quick solution for a date problem? To: KEVIN MANNING <[hidden email]>, [hidden email] > So how about just adding the 100 years? > In the syntax below, it prevents adding 100 years to any date that is > more than 1/1/1908 (you could use any date that makes sense with your > data. > > if (testdt<date.mdy(1,1,1908)) testdt=datesum(testdt,100,"YEAR"). > > Melissa > > -----Original Message----- > From: SPSSX(r) Discussion [ On Behalf Of KEVIN MANNING > Sent: Friday, June 29, 2007 7:30 AM > To: [hidden email] > Subject: Re: [SPSSX-L] Quick solution for a date problem? > > Thank you. Unfortunately, I do not have any additional syntax or > output; this data was entered by a student of a colleague (and the > student is no longer here). So I am not sure if the student actually > entered the dates "1902" (all four digits) or what, but the dates > should range from 1998-2002. We have checked the options for the > century as you have specified, no luck. Regardless, thanks for your > Kevin > > > > ----- Original Message ----- > From: Richard Ristow <[hidden email]> > Date: Thursday, June 28, 2007 10:16 pm > Subject: Re: Quick solution for a date problem? > To: KEVIN MANNING <[hidden email]>, [hidden email] > Cc: "Oliver, Richard" <[hidden email]>, Melissa Ives > <[hidden email]> > > > > At 03:48 PM 6/28/2007, KEVIN MANNING wrote: > > > > >Date is entered as a variable as dd/mm/yyyy, but for some reason > > >the > > > > >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead > > >of > > > > >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? > > > > See Richard Oliver's reply, but you can see that he's a bit > > mystified, > > > > too. > > > > As general advice: When you aren't getting the result you want, it > > helps if you can give us the exact syntax that seems not to be > > working; some test data, with some input you passed to the syntax; > > and > > > the output from that data and the syntax, with any error or warning > > > messages exactly as they were printed. And, what output you wanted > > instead of the output you got. > > > > The more we know, the more we can help. And debugging is like > > proofreading, or medical diagnosis: It's the details, and the exact > > > information, that matter. > > > > -Good luck, and by all means give us a follow-up post, > > Richard > > > PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any > attachments may contain PRIVILEGED AND CONFIDENTIAL information and is > intended only for the use of the addressee. If you are not the > designated recipient, or an employee or agent authorized to deliver > such transmittals to the designated recipient, you are hereby notified > that any dissemination, copying or publication of this transmittal is > strictly prohibited. If you have received this transmittal in error, > please notify us immediately by replying to the sender and delete this > copy from your system. You may also call us at (309) 827-6026 for > assistance. |
|
Thank you Richard and Melissa, that worked great.
Kevin ----- Original Message ----- From: Melissa Ives <[hidden email]> Date: Friday, June 29, 2007 9:53 am Subject: RE: RE: Re: [SPSSX-L] Quick solution for a date problem? To: KEVIN MANNING <[hidden email]> Cc: [hidden email] > That works fine for me. What version of SPSS are you using? It is > having trouble with column 33 which is the = sign after dob. Does the > version you are using have the option for DATESUM? > > If not you could break the date down and add 100 that way. > > if (dob<date.mdy(1,1,1908)) > dob=date.mdy(xdate.month(dob),xdate.mday(dob),(xdate.year(dob)+100)). > > Melissa > > -----Original Message----- > From: KEVIN MANNING [ > Sent: Friday, June 29, 2007 8:34 AM > To: Melissa Ives > Cc: [hidden email] > Subject: Re: RE: Re: [SPSSX-L] Quick solution for a date problem? > > Thank you. Am I making an error here? Output error message is not > reading date sum? > > "DOB" is my date variable. > > if (dob<date.mdy(1,1,1908)) dob=datesum(dob,100,"YEAR"). > > >Error # 4032 in column 33. Text: datesum The CTIME, DATE, TIME and > >XDATE functions, as well as CDF, IDF, NCDF, NPDF, PDF, and RV functions > > >require a function modifier. None was found. > >This command not executed. > > > > > > > ----- Original Message ----- > From: Melissa Ives <[hidden email]> > Date: Friday, June 29, 2007 9:17 am > Subject: RE: Re: [SPSSX-L] Quick solution for a date problem? > To: KEVIN MANNING <[hidden email]>, [hidden email] > > > > So how about just adding the 100 years? > > In the syntax below, it prevents adding 100 years to any date that > is > > more than 1/1/1908 (you could use any date that makes sense with > your > > data. > > > > if (testdt<date.mdy(1,1,1908)) testdt=datesum(testdt,100,"YEAR"). > > > > Melissa > > > > -----Original Message----- > > From: SPSSX(r) Discussion [ On Behalf Of KEVIN MANNING > > Sent: Friday, June 29, 2007 7:30 AM > > To: [hidden email] > > Subject: Re: [SPSSX-L] Quick solution for a date problem? > > > > Thank you. Unfortunately, I do not have any additional syntax or > > output; this data was entered by a student of a colleague (and the > > > student is no longer here). So I am not sure if the student > actually > > entered the dates "1902" (all four digits) or what, but the dates > > should range from 1998-2002. We have checked the options for the > > century as you have specified, no luck. Regardless, thanks for your > help. > > Kevin > > > > > > > > ----- Original Message ----- > > From: Richard Ristow <[hidden email]> > > Date: Thursday, June 28, 2007 10:16 pm > > Subject: Re: Quick solution for a date problem? > > To: KEVIN MANNING <[hidden email]>, [hidden email] > > Cc: "Oliver, Richard" <[hidden email]>, Melissa Ives > > <[hidden email]> > > > > > > > At 03:48 PM 6/28/2007, KEVIN MANNING wrote: > > > > > > >Date is entered as a variable as dd/mm/yyyy, but for some reason > > > > >the > > > > > > >dates for 2000+ are reading as dd/mm/1901, dd/mm/1902, ...instead > > > > >of > > > > > > >dd/mm/2001, so on. Anyone know of an easy way to fix this problem? > > > > > > See Richard Oliver's reply, but you can see that he's a bit > > > mystified, > > > > > > too. > > > > > > As general advice: When you aren't getting the result you want, it > > > > helps if you can give us the exact syntax that seems not to be > > > working; some test data, with some input you passed to the syntax; > > > > and > > > > > the output from that data and the syntax, with any error or warning > > > > > messages exactly as they were printed. And, what output you wanted > > > > instead of the output you got. > > > > > > The more we know, the more we can help. And debugging is like > > > proofreading, or medical diagnosis: It's the details, and the exact > > > > > information, that matter. > > > > > > -Good luck, and by all means give us a follow-up post, > > > Richard > > > > > > PRIVILEGED AND CONFIDENTIAL INFORMATION This transmittal and any > > attachments may contain PRIVILEGED AND CONFIDENTIAL information and > is > > > intended only for the use of the addressee. If you are not the > > designated recipient, or an employee or agent authorized to deliver > > > such transmittals to the designated recipient, you are hereby notified > > > that any dissemination, copying or publication of this transmittal > is > > strictly prohibited. If you have received this transmittal in error, > > > please notify us immediately by replying to the sender and delete this > > > copy from your system. You may also call us at (309) 827-6026 for > > assistance. |
| Free forum by Nabble | Edit this page |
