Re: Recoding Date and time into another variable

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Recoding Date and time into another variable

Melissa Ives
Under 'Date and Time functions', there is one that does your first
variable automatically.  (if you want different numbers, you can simply
recode it after running this.)

XDATE.WKDAY. XDATE.WKDAY(datevalue). Numeric. Returns the day-of-week
number (an integer between 1, Sunday, and 7, Saturday) from a numeric
value in date format, as created by the DATE.xxx functions or read by
one of the DATE input formats.

Melissa

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Sjoerd van den Berg
Sent: Sunday, November 26, 2006 12:21 PM
To: [hidden email]
Subject: [SPSSX-L] Recoding Date and time into antoher variable

Dear all,

For an comprehensive laboratory animal monitoring system I would like to
recode the follwing variables in to tw onew variables:

The alod variables are

Date            Time            AM_PM
______________________________________
2006/05/02 10:18:09,00 AM
2006/05/02 10:25:39,00 AM

And I would like to generate

One variable:

All data points deriven from one date ( e.g. 2006/05/02 ) as a "day"
this would look something like

2006/05/02 = 1
2006/05/03 = 2
2006/05/04 = 3

In which I can add the labels that 1 = tuesday, 2 = wednesday etc.

The other variable I would like to derive is

2006/05/02 - 06.00.00 am to 06.00.00 pm = 1
2006/05/02 - 06.00.00 pm to 2006/05/03 - 06.00.00 am = 2
2006/05/03 - 06.00.00 am to 06.00.00 pm = 3
2006/05/03 - 06.00.00 pm to 2006/05/04 - 06.00.00 am = 4

So in this case all "half days" ( or in other words, day and night
periods, are stated.

Later, I can add the labels that 1 = tuesday, 2 = wednesday etc.

Since this data set will be used by other researcher too, I would really
like to have both variables.

Data and Time variables are in "Date" format, the AM_PM is a string
variable.

Thank you very much in advance,

kind regards

Sjoerd

___________________________________

Drs. ing. Sjoerd van den Berg
Departments of  Human and Clinical Genetics Leiden University Medical
Center PO Box 9503 2300 RA Leiden The Netherlands

tel: -31-(0)71-5276410



PRIVILEGED AND CONFIDENTIAL INFORMATION
This transmittal and any attachments may contain PRIVILEGED AND
CONFIDENTIAL information and is intended only for the use of the
addressee. If you are not the designated recipient, or an employee
or agent authorized to deliver such transmittals to the designated
recipient, you are hereby notified that any dissemination,
copying or publication of this transmittal is strictly prohibited. If
you have received this transmittal in error, please notify us
immediately by replying to the sender and delete this copy from your
system. You may also call us at (309) 827-6026 for assistance.