Help using Base SAS procedures

How to compare SAS date with a string date?

Reply
Contributor
Posts: 22

How to compare SAS date with a string date?

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: How to compare SAS date with a string date?

You will need to determine the format (CHARACTER OR SAS/NUMERIC) of the date variables involved -- best to work with SAS NUMERIC variables and make comparisons. Suggest some basic SAS DATE variable review and reading from the SAS support http://support.sas.com/ website.

Scott Barry
SBBWorks, Inc.

SAS Language Reference: Concepts - Dates, Times, and Intervals
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001112342.htm
SAS Employee
Posts: 160

Re: How to compare SAS date with a string date?

if EffectiveDate = '01jan2010'd then delete;
Ask a Question
Discussion stats
  • 2 replies
  • 503 views
  • 0 likes
  • 3 in conversation