Hou to read/extract any type of date using ANYDTDTE informat.
The following example illustrates this.
/* Read in raw data – various types of date format */
Data dates;
Input cdate $22.;
Cards;
16-apr-07
01-02-07
2007-05-06
02-jun-07
13-sep-2007
01JAN2009 14:30:08.5
;
Run;
/* Convert them to required date format using AnydtdteW */
Data Convert;
Set dates;
Date = Input (cdate, ANYDTDTE21.);
Format date date9.;
Run;
/* Output */
16APR2007
02JAN2007
06MAY2007
02JUN2007
13SEP2007
01JAN2009
This way you can read in any type of date format into SAS without having to worry about the right informat!
Monday, July 6, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment