LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Jun 2006 22:12:53 +0200
Reply-To:     =?us-ascii?Q?Jerabek=20Jindrich?= <JindraJerabek@seznam.cz>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         =?us-ascii?Q?Jerabek=20Jindrich?= <JindraJerabek@seznam.cz>
Subject:      =?us-ascii?Q?Re=3ATricky=20Date=20conversion=2E?=
Comments: To: bratchev@yahoo.com
In-Reply-To:  <20060615191428.21519.qmail@web54302.mail.yahoo.com>
Content-Type: text/plain; charset="iso-8859-2"

Hello Boris,

Following syntax should transform 6digits variable into date/time: STRING s1 (A6). COMPUTE s1 = string(GRAD_date,F6). COMPUTE y = number(substr(s1,1,2),F2). COMPUTE m = number(substr(s1,3,2),F2). COMPUTE d = number(substr(s1,5,2),F2). COMPUTE GR_date2 = DATE.DMY(d,m,y). EXEC. FORMAT GR_DATE2 (DATE10 dd-mm-yy).

Its supposed you always have 6 digits: 951105, not 95115.

HTH Jindra

> ------------ Původní zpráva ------------ > Od: Boris Ratchev <bratchev@yahoo.com> > Předmět: Tricky Date conversion. > Datum: 15.6.2006 21:23:46 > ---------------------------------------- > Hello all, > > I have the following tricky task to accomplish: I have > a 6-digit numeric variable (GRAD_DATE), e.g. "951105" > where 95 is the year 1995, 11 is the month and 05 is > the date. I'd like to convert it to a date format of, > e.g., 11/05/95 or 11/05/1995. > > The real issue is that I have to merge the file that > contains this variable into another file with the same > variable which has already been formatted as date, > e.g., like 08/12/2001. > > I'll appreciate any suggestions you might have. > > Thanks > > Boris Rachev > ICF International > Fairfax, VA 22031 > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > >


Back to: Top of message | Previous page | Main SPSSX-L page