## SAS DATE

Solved
Super Contributor
Posts: 1,041

# SAS DATE

Hi,

I have a date variable with date9. format: 20FEB2014

I need to convert it to a number 20140220 and not a date.

Regards

Accepted Solutions
Solution
‎07-22-2015 10:56 AM
Posts: 1,270

## Re: SAS DATE

data have;

date='20FEB2014'd;

date_want=input(put(date,yymmddn8.),best.);

run;

All Replies
Super User
Posts: 13,508

## Re: SAS DATE

Couple ways:

funnydate= year(date)*10000 + month(date)*100 + day(date);

or

funnydate = input(put(date,yymmdd8.),best8.);

Super Contributor
Posts: 1,041

## Re: SAS DATE

Hi Ballard,

It would throw me an error as shown below.

The dater I have there is 20FEB2014. It's numeric and date9 format.

NOTE: Invalid argument to function INPUT at line 42 column 13.

Regards

Solution
‎07-22-2015 10:56 AM
Posts: 1,270

## Re: SAS DATE

data have;

date='20FEB2014'd;

date_want=input(put(date,yymmddn8.),best.);

run;

Super Contributor
Posts: 1,041

## Re: SAS DATE

Thanks Stat,

It works. What is the logic behind putting n8.  ????

Regards

Posts: 1,270

Super User
Posts: 8,073