Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting character date to numeric date

Status
Not open for further replies.

Cauchy1412

Programmer
Jul 5, 2005
2
US
I have a SAS file where the dates (e.g. 6/25/2005) were formatted in Character type. I would like to compute elapsed number of days between entered dates, so I need to change the type in order to do this, correct? Here is what I tried:

datevar1 = INPUT(DATE1A, mmddyy8.);
datevar2 = INPUT(DATE1B, mmddyy8.);

datediff = datevar2 - datevar1;
run;

When I do this I get this NOTE: Invalid argument to function INPUT at line...

I am a new to SAS and researched several websites about type conversion before posting this. Does someone have a suggestion on what I should try next?

Thanks.
Joe
 
Cauchy1412,
You prob don't need this but you can use what you discoved like this:


Code:
days = DATDIF(INPUT(DATE1A, mmddyy10.),INPUT(DATE1B, mmddyy10.),'act/act');

Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top