How to convert a given date value into SAS date

Answer Posted / arish kumar

e.g the date is '05/09/2007'

we can use the input function to convert this string into SAS date i.e.
date='05/09/2007'
sasdate=input(date,mmddyy10.);

Also, we can use mdy function.For this first use substr function.

m=substr(date,4,2);
d=substr(date,1,2);
y=substr(date,7,4);
sasdate=mdy(m,d,y);

Is This Answer Correct ?    21 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between floor and ceil functions in sas? : Sas-administrator

702


What is the difference between using drop = data set option in data statement and set statement?

638


What is the maximum length of the macro variable?

676


How to sort in descending order?

794


What is the purpose of _character_ and _numeric_?

589






What are the five ways to do a table lookup in sas? : sas-grid-administration

595


Explain the purpose of substr functions in sas programming.

563


What Proc glm does?

610


what is proc Index? and what is proc document?

1996


explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di

543


why is a stop statement needed for the point=option on a set statement? : Sas programming

587


Are you sensitive to code walk-throughs peer review or QC review?

2606


Mention sas system options to debug sas macros.

659


how are numeric and character missing values represented internally? : Sas programming

619


What are the difference between ceil and floor functions in sas?

706