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

How would you identify a macro variable?

650


What is the difference between INPUT and INFILE ?

754


what is the basic structure sas administrator? : Sas-administrator

563


How to sort in descending order?

794


how to remove duplicates using proc sql?

630






What do the SAS log messages "numeric values have been converted to character" mean?

888


What are SAS/ACCESS and SAS/CONNECT?

630


Hi,by usining ptf how we have to combine (likr merge)10 datasets at a time in the oracle database(and write a macro code also)?Like this i have a douts a lot if you dont mind may please send one text mail for me(madhusudhanap16@gmail.com)?

1208


Which are the statements whose placement in the data step is critical?

762


how does sas handle missing values in assignment statements? : Sas programming

567


Mention the validation tools used in SAS?

658


What is the difference between where and if statement?

619


What can you learn from the SAS log when debugging?

920


Do you need to rearrange the order of the data for the report?

1835


What areas of SAS are you most interested in?

1062