Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail |
|
At 07:38 PM 6/14/2009, Mahbub Khandoker wrote:
I want to know the way to create a new variable join date and time variable. COMPUTE ArvlDtTm = ArvlDate + ArvlTime. FORMATS ArvlDtTm (DATETIME17). The date-time variable will display as 'dd-mmm-yyyy hh:mm' rather than as 'yyyy/mm/dd hh:mm'. ===================== 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 Mahbub Khandoker-2
|
|
|
At 10:34 PM 6/14/2009, Mahbub Khandoker wrote:
Thanks Richard its work fine. How it's going to work if date and time both in string format ('2009-01-03' and '1201')? Try this. (Like the earlier code, this is untested; and it has plenty of room for mistakes.): * Arrival date is straightforward: . COMPUTE ArrivalDate = NUMBER(ArrivalDateString,SDATE10) . FORMATS ArrivalDate (ADATE10). * Arrival time is more work, because you have a non- . * standard format. Here's one of several ways: . COMPUTE #Hrs = NUMBER(SUBSTR(ArrivalTimeString,1,2),F2). COMPUTE #Mins = NUMBER(SUBSTR(ArrivalTimeString,3,2),F2). COMPUTE ArrivalTime = TIME.HMS(#Hrs,#Mins). FORMATS ArrivalTime (TIME5). * Combine, as before: . COMPUTE ArrivalDtTm = ArrivalDate + ArrivalTime. FORMATS ArvlDtTm (DATETIME17). ===================== 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 |
