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 <
[hidden email]>
> 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>
>
>