Date Formats

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Date Formats

Sam Ballard
Dear Listserv,

I have birthdates in the following numeric layout:

19791009
19830609
19800723
19871003
19811214

Is there a fast way to convert these values into a date format? SDATE
doesn't seem to work because there are no slashes. Right now I think I'll
have add slashes using SUBSTRING, so the dates look like this:

1979/10/09
1983/06/09
1980/07/23
1987/10/03
1981/12/14


Thanks in Advance,
Sam Ballard
San Diego Community College District

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Date Formats

Sam Ballard
Here is a solution sent to me off the list. It works great!
Thanks Mark.

data list fixed / bdate (n8).
begin data
19791009
19830609
19800723
19871003
19811214
end data.

compute birthdate =
        number(concat(substr(string(bdate,n8),1,4),"-",
                      substr(string(bdate,n8),5,2),"-",
                      substr(string(bdate,n8),7,2)), sdate).
format birthdate (sdate).
list.





>Dear Listserv,
>
>I have birthdates in the following numeric layout:
>
>19791009
>19830609
>19800723
>19871003
>19811214
>
>Is there a fast way to convert these values into a date format? SDATE
>doesn't seem to work because there are no slashes. Right now I think I'll
>have add slashes using SUBSTRING, so the dates look like this:
>
>1979/10/09
>1983/06/09
>1980/07/23
>1987/10/03
>1981/12/14
>
>
>Thanks in Advance,
>Sam Ballard
>San Diego Community College District
>
>=====================
>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