Date: Sun, 21 Dec 2008 21:32:35 +0000
Reply-To: karma <dorjetarap@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: karma <dorjetarap@GOOGLEMAIL.COM>
Subject: Re: Re-formatting date fields
In-Reply-To: <200812212104.mBLBlDNW006993@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
You have the choice of either applying a format after reading it in
with a datetime format. Or if you prefer you can extract the date or
time parts using functions. Here's a few examples:
data dates;
input date :anydtdte.;
dt=datepart(date);
tm=timepart(date);
format date ddmmyys10. dt ddmmyys10. tm time8.
/* for time from datetime: date time8. */;
cards;
01JUN2001:00:20:00
;run;
proc print;run;
2008/12/21 Ryan Utz <rutz@al.umces.edu>:
> I'm importing a date and time field from Access. It arrives in SAS with the
> full date/time information:
>
> 01JUN2001:00:20:00
>
> Once in, however, I'd like to re-format it so it shows just the date (in the
> form 6/1/2001) or just the time (00:20:00). I don't care if I lose
> information, as this is part of a procedure to create a bunch of .csv files.
> Is it too much to ask to display less information?!?
>
> Thanks,
> r
>
|