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 (January 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 31 Jan 2003 13:00:13 -0800
Reply-To:   cassell.david@EPAMAIL.EPA.GOV
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject:   Re: RES: earlier and later than mm/yyyy problem
Content-type:   text/plain; charset=us-ascii

Erika Elizabeth Vidal <erikae@INEP.GOV.BR> wrote: > How can I change a variable with the format 'datetime20.' to a variable with > the format 'mmddyy8.' ?

You have to change your date-time variable to a date variable. Then you can format the date variable however you like. You can do something like:

data whatever_you_like; format date mmddyy8. ; set old_data; date = datepart(your_datetime_var); run;

A SAS date variable is the number of days since 1/1/1960 . But you can format it however you like. A SAS date-time variable is the number of seconds since midnight of 1/1/1960 . So these are not stored the same way, and you have to use something like the datepart() function to make the translation.

HTH, David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician


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