|
Hello,
Could you please tell me how to change specific dates to string variables? This is the syntax I was trying to use, but I'm missing something. STRING Disposition_Date2 (A255). RECODE Disposition_Date2 select if Disposition_Date ge Date.mdy(07,01,2000) and Disposition_Date le Date.mdy(06,30,2001) eq 'FY01' and Disposition_Date ge Date.mdy(07,01,2001) and Disposition_Date le Date.mdy(06,30,2002) eq 'FY02' and Disposition_Date ge Date.mdy(07,01,2002)and Disposition_Date le Date.mdy(06,30,2003) eq 'FY03' and Disposition_Date ge Date.mdy(07,01,2003) and Disposition_Date le Date.mdy(06,30,2004) eq 'FY04' and Disposition_Date ge Date.mdy(07,01,2004) and Disposition_Date le Date.mdy(06,30,2005) eq 'FY05' and Disposition_Date ge Date.mdy(07,01,2005) and Disposition_Date le Date.mdy(06,30,2006) eq 'FY06' and Disposition_Date ge Date.mdy(07,01,2006) and Disposition_Date le Date.mdy(06,30,2007) eq 'FY07' and Disposition_Date ge Date.mdy(07,01,2007) and Disposition_Date le Date.mdy(06,30,2008) eq 'FY08' INTO Disposition_Date2. Thank you. ===================== 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 |
|
Hi,
Could you explain in more detail what you intend to do? Your question does not seem to correspond with the syntax you enclosed. Also, the syntax is not syntactically correct. Your question seems to refer to something like: STRING Disposition_Date2 (A8). COMPUTE Disposition_Date2 = string(Disposition_Date, edate8). But it seems like you want to do this only for certain dates. Maybe you should precede it with the following code. compute filter = 0. if ( Disposition_Date ge Date.mdy(07,01,2000) and Disposition_Date le Date.mdy(06,30,2001) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2001) and Disposition_Date le Date.mdy(06,30,2002) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2002) and Disposition_Date le Date.mdy(06,30,2003) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2003) and Disposition_Date le Date.mdy(06,30,2004) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2004) and Disposition_Date le Date.mdy(06,30,2005) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2005) and Disposition_Date le Date.mdy(06,30,2006) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2006) and Disposition_Date le Date.mdy(06,30,2007) ) filter = 1. if ( Disposition_Date ge Date.mdy(07,01,2007) and Disposition_Date le Date.mdy(06,30,2008) ) filter = 1. filter by filter. Cheers!! Albert-Jan --- On Wed, 8/5/09, Judy Harmon <[hidden email]> wrote: > From: Judy Harmon <[hidden email]> > Subject: Create Strings from Dates > To: [hidden email] > Date: Wednesday, August 5, 2009, 6:07 PM > Hello, > Could you please tell me how to change specific dates to > string variables? > This is the syntax I was trying to use, but I'm missing > something. > > STRING Disposition_Date2 (A255). > RECODE Disposition_Date2 > select if Disposition_Date ge Date.mdy(07,01,2000) and > Disposition_Date le > Date.mdy(06,30,2001) eq 'FY01' > and Disposition_Date ge Date.mdy(07,01,2001) and > Disposition_Date le > Date.mdy(06,30,2002) eq 'FY02' > and Disposition_Date ge Date.mdy(07,01,2002)and > Disposition_Date le > Date.mdy(06,30,2003) eq 'FY03' > and Disposition_Date ge Date.mdy(07,01,2003) and > Disposition_Date le > Date.mdy(06,30,2004) eq 'FY04' > and Disposition_Date ge Date.mdy(07,01,2004) and > Disposition_Date le > Date.mdy(06,30,2005) eq 'FY05' > and Disposition_Date ge Date.mdy(07,01,2005) and > Disposition_Date le > Date.mdy(06,30,2006) eq 'FY06' > and Disposition_Date ge Date.mdy(07,01,2006) and > Disposition_Date le > Date.mdy(06,30,2007) eq 'FY07' > and Disposition_Date ge Date.mdy(07,01,2007) and > Disposition_Date le > Date.mdy(06,30,2008) eq 'FY08' > INTO Disposition_Date2. > Thank you. > > ===================== > 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
|
In reply to this post by Judy Harmon
See inserted comments/questions below.
Is this what you want to do? string Disposition_Date (a4). if range( Disposition_Date, Date.mdy(07,01,2000), Date.mdy(06,30,2001)) Disposition_Date2 = 'FY01'. if range( Disposition_Date, Date.mdy(07,01,2001), Date.mdy(06,30,2002)) Disposition_Date2 = 'FY02'. etc. if range( Disposition_Date, Date.mdy(07,01,2007), Date.mdy(06,30,2008)) Disposition_Date2 = 'FY08'. exe.
--
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/). |
| Free forum by Nabble | Edit this page |
