Can something like the following be done in SAS?
if days(date1 - date2) = 200 then do....end
(i.e. if # days difference is 200 then perform a task.
Similarly for months or years.
Try intck to calculate number of days/months between two dates.
if intck('day',date1,date2) = 200 then do /* for days */
if intck('month',date1,date2) = 200 then do /* for months */
Assuming Date1 and Date2 are SAS dates would the following not work?
If (Date1 - date2) eq 200 then Do ;
end ;
For the months and years the Intck function woudl work as shown by stat@sas. Of course, we have not yet talked about 'alignment' on months and years!
I would replace the if statement by if ABS(date1 - date2) eq 200 then Do; because we do not know what date is more recent.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.