Hello Dear All,
I have a "closed date" variable which I want to compare other date value in my record with this closed date and find closer date to this date.These dates should be less than closed date too. Do you have any idea! Thank you Behnaz _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ |
Closer then what? Give us an example and look at the DATEDIFF function.
-----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of behnaz shirazi Sent: Monday, February 26, 2007 2:25 PM To: [hidden email] Subject: Closest date Hello Dear All, I have a "closed date" variable which I want to compare other date value in my record with this closed date and find closer date to this date.These dates should be less than closed date too. Do you have any idea! Thank you Behnaz _________________________________________________________________ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ |
ok.Let' say:
I have these different time variables in my data set.T1 T2 T3 T4 .....T24.I have also another variable named"closed date".I want to find the biggeste T before Closed Date. Othe view... If I have: T1 T3 T9 T15 Closed date T16 T2 (1/1/2005) (1/29/2005) (4/3/2006) (8/11/2006) (10/11/2006) (1/11/2007) (2/11/2007) I want to find T15 which it is the most recent date before closed date. I hope I gave you a whole picture. Thanks Behnaz >From: "Beadle, ViAnn" <[hidden email]> >To: "behnaz shirazi" <[hidden email]>,<[hidden email]> >Subject: RE: Closest date >Date: Mon, 26 Feb 2007 14:43:42 -0600 > >Closer then what? Give us an example and look at the DATEDIFF function. > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >behnaz shirazi >Sent: Monday, February 26, 2007 2:25 PM >To: [hidden email] >Subject: Closest date > >Hello Dear All, > >I have a "closed date" variable which I want to compare other date value in >my record with this closed date and find closer date to this date.These >dates should be less than closed date too. > >Do you have any idea! > > >Thank you >Behnaz > >_________________________________________________________________ >FREE pop-up blocking with the new MSN Toolbar - get it now! >http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
In reply to this post by behnaz shirazi-2
I am not an SPSS expert but you should look at sorting your data and
using the first and last commands to select the first and last date in combination with some deleting statements. Fermin Ornelas, Ph.D. Management Analyst III, AZ DES Tel: (602) 542-5639 E-mail: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of behnaz shirazi Sent: Monday, February 26, 2007 1:56 PM To: [hidden email] Subject: Re: Closest date ok.Let' say: I have these different time variables in my data set.T1 T2 T3 T4 .....T24.I have also another variable named"closed date".I want to find the biggeste T before Closed Date. Othe view... If I have: T1 T3 T9 T15 Closed date T16 T2 (1/1/2005) (1/29/2005) (4/3/2006) (8/11/2006) (10/11/2006) (1/11/2007) (2/11/2007) I want to find T15 which it is the most recent date before closed date. I hope I gave you a whole picture. Thanks Behnaz >From: "Beadle, ViAnn" <[hidden email]> >To: "behnaz shirazi" <[hidden email]>,<[hidden email]> >Subject: RE: Closest date >Date: Mon, 26 Feb 2007 14:43:42 -0600 > >Closer then what? Give us an example and look at the DATEDIFF function. > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >behnaz shirazi >Sent: Monday, February 26, 2007 2:25 PM >To: [hidden email] >Subject: Closest date > >Hello Dear All, > >I have a "closed date" variable which I want to compare other date value in >my record with this closed date and find closer date to this date.These >dates should be less than closed date too. > >Do you have any idea! > > >Thank you >Behnaz > >_________________________________________________________________ >FREE pop-up blocking with the new MSN Toolbar - get it now! >http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR CONFIDENTIAL information and is intended only for the use of the specific individual(s) to whom it is addressed. It may contain information that is privileged and confidential under state and federal law. This information may be used or disclosed only in accordance with law, and you may be subject to penalties under law for improper use or further disclosure of the information in this e-mail and its attachments. If you have received this e-mail in error, please immediately notify the person named above by reply e-mail, and then delete the original e-mail. Thank you. |
In reply to this post by behnaz shirazi-2
Here's a quick and dirty approach that I'd bet others will amend to a more elegant solution.
I compute the absolute differences into as many vars as time points. I then compute the minimum difference and store that in a variable. I then check to see if that variable is equal to each absolute difference and if so, compute the selection date from the observed date.: do repeat time=t1 to t4/tdiff=tdiff1 to tdiff4. compute tdiff=abs(datediff(close,time,"days")). end repeat. compute minvalue=minimum(tdiff1 to tdiff4). numeric seldate. format seldate (adate9). do if (minvalue = tdiff1). compute seldate=t1. else if (minvalue = tdiff2). compute seldate = t2. else if (minvalue=tdiff3). compute seldate = t3. else. compute seldate=t4. end if. list. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of behnaz shirazi Sent: Monday, February 26, 2007 2:56 PM To: [hidden email] Subject: Re: Closest date ok.Let' say: I have these different time variables in my data set.T1 T2 T3 T4 .....T24.I have also another variable named"closed date".I want to find the biggeste T before Closed Date. Othe view... If I have: T1 T3 T9 T15 Closed date T16 T2 (1/1/2005) (1/29/2005) (4/3/2006) (8/11/2006) (10/11/2006) (1/11/2007) (2/11/2007) I want to find T15 which it is the most recent date before closed date. I hope I gave you a whole picture. Thanks Behnaz >From: "Beadle, ViAnn" <[hidden email]> >To: "behnaz shirazi" <[hidden email]>,<[hidden email]> >Subject: RE: Closest date >Date: Mon, 26 Feb 2007 14:43:42 -0600 > >Closer then what? Give us an example and look at the DATEDIFF function. > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >behnaz shirazi >Sent: Monday, February 26, 2007 2:25 PM >To: [hidden email] >Subject: Closest date > >Hello Dear All, > >I have a "closed date" variable which I want to compare other date value in >my record with this closed date and find closer date to this date.These >dates should be less than closed date too. > >Do you have any idea! > > >Thank you >Behnaz > >_________________________________________________________________ >FREE pop-up blocking with the new MSN Toolbar - get it now! >http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
In reply to this post by Beadle, ViAnn
You know what ? I should say "THANK YOU" because somehow (trick) I solved my
problem with datediff which I didn't think can help. Thanks again Behnaz Shirazi >From: "Beadle, ViAnn" <[hidden email]> >To: "behnaz shirazi" <[hidden email]>,<[hidden email]> >Subject: RE: Closest date >Date: Mon, 26 Feb 2007 14:43:42 -0600 > >Closer then what? Give us an example and look at the DATEDIFF function. > >-----Original Message----- >From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of >behnaz shirazi >Sent: Monday, February 26, 2007 2:25 PM >To: [hidden email] >Subject: Closest date > >Hello Dear All, > >I have a "closed date" variable which I want to compare other date value in >my record with this closed date and find closer date to this date.These >dates should be less than closed date too. > >Do you have any idea! > > >Thank you >Behnaz > >_________________________________________________________________ >FREE pop-up blocking with the new MSN Toolbar - get it now! >http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |
Free forum by Nabble | Edit this page |