|
Dear friends. I am trying to convert a string variable that contains
dates to a specific variable with date format in order to finally calculate number of days associated with each date. My string variable called adm_date has 14 fields. I tried to extract year, month and day, but I found some issues since days could vary from 1 or 2 digits and the same for months: 2007-1-1, 2007-12-12 so my substring use not helped me. Does anyone know a way to get the result that I expect??? Thanks again for contributing with your knowledge! -- __________________________________________________________________ *Rodrigo Briceño* Project Manager Sanigest Internacional +506 22-91-12-00 ext. 113 * Oficina* *Costa Rica* +506 22-32-08-30 *Fax *+506 88-86-11-77* Celular** *[hidden email] <mailto:[hidden email]> www.sanigest.com <http://www.sanigest.com/> MSN: [hidden email] <mailto:[hidden email]> SKYPE: rbriceno1087 _____________________ This communication contains legal information which is privileged and confidential. It is for the exclusive use of the address and distribution, dissemination, copying or use by others is strictly prohibited. If you have received this communication by error, please delete the original message and e-mail us. Esta comunicación contiene información legal privilegiada y confidencial para el uso exclusivo del destinatario. La distribución, diseminación, copia u otro uso por terceras personas es estrictamente prohibida. Si usted ha recibido esta comunicación por error, le rogamos borrar el mensaje original y comunicárnoslo a esta misma dirección. ===================== 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 |
|
If the string date is yyyy-mm-dd, this is easily converted:
compute realdate=number(stringdate,sdate10). formats realdate (sdate10). You can change the Formats command to specify any date format you want, but you need to specify Sdate format on the Compute command to tell SPSS how to interpret the string data values. -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Rodrigo Briceño Sent: Wednesday, March 26, 2008 11:28 AM To: [hidden email] Subject: handling dates Dear friends. I am trying to convert a string variable that contains dates to a specific variable with date format in order to finally calculate number of days associated with each date. My string variable called adm_date has 14 fields. I tried to extract year, month and day, but I found some issues since days could vary from 1 or 2 digits and the same for months: 2007-1-1, 2007-12-12 so my substring use not helped me. Does anyone know a way to get the result that I expect??? Thanks again for contributing with your knowledge! -- __________________________________________________________________ *Rodrigo Briceño* Project Manager Sanigest Internacional +506 22-91-12-00 ext. 113 * Oficina* *Costa Rica* +506 22-32-08-30 *Fax *+506 88-86-11-77* Celular** *[hidden email] <mailto:[hidden email]> www.sanigest.com <http://www.sanigest.com/> MSN: [hidden email] <mailto:[hidden email]> SKYPE: rbriceno1087 _____________________ This communication contains legal information which is privileged and confidential. It is for the exclusive use of the address and distribution, dissemination, copying or use by others is strictly prohibited. If you have received this communication by error, please delete the original message and e-mail us. Esta comunicación contiene información legal privilegiada y confidencial para el uso exclusivo del destinatario. La distribución, diseminación, copia u otro uso por terceras personas es estrictamente prohibida. Si usted ha recibido esta comunicación por error, le rogamos borrar el mensaje original y comunicárnoslo a esta misma dirección. ===================== 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 |
| Free forum by Nabble | Edit this page |
