How to convert a given date value into SAS date

Answer Posted / vinay

/*let date is '10/07/1985'/*
/*SAS CODING*/
data date;
input date $;
Var_Date=input(date,mmddyy10.);/*Apply format within input
function to convert text value to number value*/
/*now extract value of month,date and year through date
functions*/
m=substr(Var_Date,4,2);
d=substr(Var_Date,1,2);
y=substr(Var_Date,7,4);
sasdate=mdy(m,d,y);
cards;
10/07/1985
;
run;
proc print dtat=date;
run;

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe 5 ways to do a “table lookup” in SAS?

876


Name and describe few sas character functions that are used for data cleaning in brief.

869


What is data _null_?

888


How can you limit the variables written to output dataset in data step?

1014


Enlist the syntax rules followed in sas statements.

833


List out some key concept of SAS

805


what is intially documentation in sas?

4613


What is the work of tranwrd function?

934


where to use sas business intelligence? : Sas-bi

773


what is sas application server? : Sas-di

716


What is the use of %include statement?

813


What is SAS?

798


What would be the result of the following SAS function (given that 31 Dec, 2000 is Sunday)?

914


what r the job openings SAS for fresher graduates !

2193


What are the data types that sas contain?

891