Date: Wed, 30 Oct 2002 11:20:52 -0500
Reply-To: Art@DrKendall.org
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Arthur J. Kendall" <Arthur.Kendall@VERIZON.NET>
Subject: Re: Convert date type variable to string
Content-Type: text/plain; charset=us-ascii; format=flowed
this creates a new string variable. It cannot be used in computations.
This is not the same as changing the display formats.
the length of the string variable will depend on what date format you want.
data list fixed /birthday (adate10).
begin data.
05/28/1946
10/12/1900
03/22/2000
02/12/2002
10/30/2002
10/31/2002
end data.
string str_date(a11) b_wkday (a9) b_month (a9).
compute str_date = string(birthday,date11).
compute b_wkday = string(birthday,wkday9).
compute b_month = string(birthday, month8).
list.
execute.
* for listings you can simply write the date variable with different
formats.
print /birthday * birthday (date11) birthday (1x, wkday9) birthday (1x,
month8).
execute.
Hope this helps.
Art
Art@DrKendall.org
Social Research Consultants
University Park, MD USA
Nan Li wrote:
>Does anyone know how to convert date type variable to string by syntax?
>Thanks in advance!
>
>nan
>
>
>
|