Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assistance with cleaning date variables in a data set 1

Status
Not open for further replies.

Stew32

Technical User
Oct 3, 2010
2
US
I'm currently learning SAS and trying to clean a moderate size data set (~10000 observations) using version SAS 9.2.2.

I could use some help with the following . . . For date variables I'd like to check that the day value falls between 1 & 31, the month value falls between 1 & 12, and the year equals 2008 (year limited by the data set). I need to flag entries that do not follow standard conventions. How do I go about this? (The dates are numerical variables formatted as yymmdd10. and E8601DT19.)
 
why not use SAS's input function with the above mentioned formats? This way any date that doesnt meet the convention will end as a missing value.

Then you 'know' all your bad date values.
ex
Code:
sasdatevalue = input(your_date_value,mmddyy10.);
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top