How do you subtract weeks from a given date? how can i code that
for example I have a data with a date (date1 ) and I want to subtract 36 weeks and get a new date (date2). please look the table below for example.
date1 date 2
5/3/2012 8/25/2011
6/4/2012 9/26/2011
Use the INTNX function with a 'week' interval.
Use the INTNX function with a 'week' interval.
Another way to do this is to suntract 36*7 from each date.
How many times has it been suggested to you to provide data in the form of a data step?
For one thing, we need to know if the values are actually SAS data values or not.
This shows adjusting a date by 36 weeks to the Same day of the week, Beginning of the week or End of the week.
data have; input date1 :mmddyy10.; datalines; 5/3/2012 6/4/2012 ; data want; set have; date2= intnx('week',date1,-36,'s'); date3= intnx('week',date1,-36,'b'); date4= intnx('week',date1,-36,'e'); format date: mmddyy10.; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.