I have a column named "EffectiveDate". I want to check for a record that has an EffectiveDate of "01-01-2010", then this record need to be removed. I don't know how to compare since the EffectiveDate is formated in Date type and the values look numerics. Can I use put function to convert the EffectiveDate to string? then I compare it with "01-01-2010". Your inputs are much appreciated.
In addition to converting the variable, you can also use Date constants to perform your selection or your deletion in a DATA step program (or PROC SQL step):
if EffectiveDate = '01JAN2010'd then delete;
The date constant form 'DDMMMYYYY'D or 'DDMMMYY'D allows you to supply a date in "readable" format and the D at the end of the constant tells SAS to convert that value to an internal date value, so it would be as though you were specifying this:
if EffectiveDate = 18263 then delete;
because '01jan2010'D is the date constant way to specify 18263 -- which represents January 1, 2010, which will be 18,263 days from Jan 1, 1960.
If EffectiveDate was a DATE/TIME variable, then you might have to use a different function to specify your comparison...something like:
if datepart(EffectiveDate) = '01jan2010'd then delete;