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 are the difference between ceil and floor functions in sas?

713


what is sas metadata server? : Sas-di

597


What do you code to create a macro? : sas-macro

588


Explain proc sort?

673


What is slibref?

748






What is the difference between one to one merge and match merge? Give an example.

579


how would you create multiple observations from a single observation? : Sas programming

572


What is program data vector (pdv)?

637


what is sas business intelligence? : Sas-bi

594


What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

2010


what do the pad and dim functions do? : Sas programming

568


Are you involved in writing the inferential analysis plan? Tables specfications?

2119


What function CATX syntax does?

693


What can be the size of largest dataset in SAS?

723


what is hierarchy flattening? : Sas-di

622