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

Briefly explain input and put function?

818


What is the maximum length of the macro variable? : sas-macro

846


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

2879


Which command is used to perform sorting in sas program?

779


Why double trailing @@ is used in input statement?

920


Name some categories in sas 9? : sas-grid-administration

731


In SAS explain which statement does not perform automatic conversions in comparisons?

1059


what is the Population you used in your project, is it ITT or PP?

2445


what is business intelligence? : Sas-bi

793


Explain why double trailing @@ is used in input statement?

786


what are _numeric_ and _character_ and what do they do? : Sas programming

875


I have a SCD Type 2 Dimention for Location In which A Sales Office in Having two Surrogate Keys just because of the change in it's Sales Group. SKey SalesGroup Sales Office BeginDate EndDate 280 SG1 SO1 01APR2000 01APR2010 281 SG2 SO1 02APR2010 31MAR2999 Now while loading the Fact, the Lookup ir returning SKey 280 for records before and after 01APR2010. I am not able to give WHERE condition in the Lookup Properties (TranDate between BeginDate and EndDate). Please help.

1911


Can you explain the process of calendar?

856


In sas admin differentiate between roles and capabilities? : sas-grid-administration

758


what are all the reports you generated in your recent project?

1931