|
I apologize if this is a very basic question, but I need to format a date as
month, day. Is this possible? Yes, I want my date to exclude and ignore the year. Many thanks, Brock ===================== 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 |
|
At 03:36 PM 6/7/2009, Brock wrote:
I need to format a date as month, day. Yes, I want my date to exclude and ignore the year. It doesn't look like there's a date format you can attach to a variable so it'll display as 'MON-dy' or whatever. If you can stand converting your SPSS dates to string variables for display (and only for display!), you can use string manipulation. Be careful! No matter how you display it, an SPSS date always contains a year. Make sure the years are right, if you compare values or compute intervals between values. But, here are dates, converted to strings with month-day only, in two formats: STRING MDayDate (A10) MDayAmer (A10). * Minimum widths are 6 and 5, respectively . COMPUTE MDayDate = SUBSTR(STRING(In_Date,DATE11) ,1,6). COMPUTE MdayAmer = SUBSTR(STRING(In_Date,ADATE10),1,5). LIST List |-----------------------------|---------------------------| |Output Created |07-JUN-2009 17:29:33 | |-----------------------------|---------------------------| In_Date MDayDate MDayAmer 04-JUL-1776 04-JUL 07/04 06-JUN-1944 06-JUN 06/06 07-JUN-2009 07-JUN 06/07 Number of cases read: 3 Number of cases listed: 3 ============================== APPENDIX: Test data, and code ============================== DATA LIST FREE /In_Date (DATE). BEGIN DATA 04-JUL-1776 06-JUN-1944 07-JUN-2009 END DATA. LIST. * Minimum widths are 6 and 5, respectively . STRING MDayDate (A10) MDayAmer (A10). COMPUTE MDayDate = SUBSTR(STRING(In_Date,DATE11) ,1,6). COMPUTE MdayAmer = SUBSTR(STRING(In_Date,ADATE10),1,5). LIST. ===================== 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 |
|
In reply to this post by Brock-15
Thanks for getting back to me. I was hoping I wouldn't have to go that
route, but at least its an option. - Brock ===================== 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 |
