=========================================================================
Date: Wed, 12 Jul 2006 10:58:59 -0400
Reply-To: Edward Boadi <eboadi@abhct.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Edward Boadi <eboadi@abhct.com>
Subject: Re: Transforming date variables
Content-Type: text/plain; charset="iso-8859-1"
Try This:
Compute Var_Year = number(substr(Date_var,1,4)).
Compute Var_Month = number(substr(Date_var,5,2)).
Compute Var_Day = number(substr(Date_var,7,2)).
Compute New_Date = DATE.MDY(Var_Month,Var_Day,Var_Year).
FORMATS New_Date (ADATE10).
EXECUTE.
---Edward.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
[Ela Bonbevan]
Sent: Wednesday, July 12, 2006 10:25 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Transforming date variables
Hello all,
Another small question - I am working with spss 14 and using the date
function. I have a variable imported from Excel that is a date but it is
in a numeric format. I want to make it a recognized date variable in
spss. For July 25, 2006 the value appears as 20060725. Using the
date/time wizard it appears easiest to transform a variable that is a
string. I want to do this in the syntax but I can't figure out how. This
means that I have to go back to the data window and change it to a string
manually. I am sure this is easy to do but I have been through the manual
section on formats with no luck...
Many thanks
Diane
|