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 (February 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 28 Feb 2002 09:42:49 -0700
Reply-To:     Jose Benuzillo <Jose.Benuzillo@nurs.utah.edu>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Jose Benuzillo <Jose.Benuzillo@nurs.utah.edu>
Subject:      Re: Date Conversion
Comments: To: Mahbub_Khandoker@camh.net
Content-Type: text/plain; charset=US-ASCII

here is an example.

original variable start it looks like this Wed 05/10/2000 22:27:59 "string"

needed variable date1 it will look like this 05/10/2000 "date"

syntax

compute mnthx = number(substr(start,5,2),f2). compute dayx = number(substr(start,8,2),f2). compute yrx = number(substr(start,11,4),f4.0). compute date1 = date.mdy(mnthx,dayx,yrx). format date1 (adate10).

It tells the computer 1. to read two places from place five 2. to save as numeric variable into mnthx.

same for dayx and yrx

then I used a time function ( date.mdy ) that requires three arguments month, day, and year to generate the variable date1 finally I give format to the variable.

you can use a diferent date function.

Jose G Benuzillo. University of Utah.

>>> Mahbub Khandoker <Mahbub_Khandoker@camh.net> 02/28/02 09:12AM >>> Hello: I have a data set with date as one of the variables. The date variable data is pullout from Cognos Impromptu to Excel and then convert to SPSS. In SPSS the date is treated as string and my first and simple question is, how can I convert this string to date format? The next question is, whether is it possible to select only the weekend dates automatically by SPSS from this dates? The data set are as follows, Admission Date Health Record Number 2001-03-01 087900 1990-07-27 458900 2001-02-16 895241 2001-03-09 448801 1998-09-30 890210 1999-12-31 754890

Any suggestions would be greatly appreciated. Thanks in advance. Mahbub Khandoker


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