Date: Mon, 27 Oct 2008 15:56:14 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: Date variable question
In-Reply-To: <200810271919.m9RGDAwJ015427@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Here you go ... val1 and val2 are actual DATE values, if you need them as
strings you need to put ( ) them back into a string.
-Joe
data
have;
format inval
$6.;
input inval
$;
cards;
060313
;;;
run;
data
want;
set
have;
format val1 YYMMDDn8.; **val1 is YYMMDDN8. (YYYYMMDD with no
separator);
format val2 DATE9.; **val2 is DATE9. (DDMONYYYY);
val1 = input(inval,YYMMDD6.); **read inval using the YYMMDD mask,which
converts to a numeric data value and then val1 format shows it as YYYYMMDD;
val2 =
input(inval,YYMMDD6.);
run;
On Mon, Oct 27, 2008 at 2:19 PM, Annie Lee <hummingbird10111@hotmail.com>wrote:
> Hi,
>
> What is the best way to change character variable 060313 to 20060313 and
> then 13Mar2006?
> I would need both dates 20060313 & 13Mar2006.
> Thank you.
>
|