From: Sdlentertd on
I have a date field can be numeric and populated or
character and blank (only these 2 scenarios)
if it's populated it has this format MMDDYY10. numeric and if it's
character then it's just blank.


so what i need is for the numeric date to look like this: Numeric,
Length 8, Format 11. and look like 20100214 and if it's
character then convert it so it looks like 20100214.

Thank you

From: Joe Matise on
I presume this is a linked question to your other one.

If this is an excel sheet and you want to force it to come in properly, then
use DBSASOPTS or similar in the import/libname. If you have an already
existing dataset, or just prefer to do it this way, you could create a new
variable, format it numeric, and then set it equal to the other variable; it
will always be numeric, and will be missing if the variable is formatted
(and contains) characters.

ie

data want;
set have;
format newdatevar YYMMDDN8.;
newdatevar = olddatevar;
run;

-Joe

On Thu, Feb 18, 2010 at 11:48 AM, Sdlentertd <sdlentertd(a)gmail.com> wrote:

> I have a date field can be numeric and populated or
> character and blank (only these 2 scenarios)
> if it's populated it has this format MMDDYY10. numeric and if it's
> character then it's just blank.
>
>
> so what i need is for the numeric date to look like this: Numeric,
> Length 8, Format 11. and look like 20100214 and if it's
> character then convert it so it looks like 20100214.
>
> Thank you
>
 | 
Pages: 1
Prev: Date Format issue
Next: put the space in data step