Hi:
That's really strange. When I subtract 365 from the internal value for 29Feb08 (17591) , I get the internal value for 03/01/2007 (17226). Depending on how you're handling and using your macro variables, you may not have the macro variable in the correct numeric form for doing the subtraction. If &DATE1 resolves to the TEXT string 29Feb08, then it's not really a SAS date value -- it's just a text string that happens to look like a date. Your text string has to be recognized as the number of days since Jan 1, 1960 in order for your subtraction to work correctly.
I've inserted some test code below. Your best bet for help is to contact Tech Support so they can look at ALL of your code -- where the macro variables are set and how/where you're performing the subtraction so they can help you with the correct syntax. As you can see in the code below, you would do the subtraction slightly differently in ALL macro versus inside the DATA step program.
cynthia
[pre]
** All macro;
%let date1=29Feb08;
%let date2=31Dec08;
%put ------------------***;
%put date1 is: &date1;
%put date2 is: &date2;
%put ------------------***;
%let dateval = %sysfunc(inputn(&date1,date7.));
%let calc = %eval(&dateval - 365);
%put dateval is: &dateval;
%put calc is: &calc;
%let yearago1 = %sysfunc(putn(&calc,mmddyy10.));
%put ******* yearago1 is: &yearago1;
** use in DATA step program;
data testmacvar;
d_date1 = "&date1"d;
d_date2 = "&date2"d;
yearago1 = "&date1"d - 365;
yearago2 = "&date2"d - 365;
format d_date1 d_date2 yearago1 yearago2 mmddyy10.;
run;
options nocenter;
ods listing;
proc print data=testmacvar;
run;
[/pre]
SAS Log & output:
[pre]
198 %let date1=29Feb08;
199 %let date2=31Dec08;
200 %put ------------------***;
------------------***
201 %put date1 is: &date1;
date1 is: 29Feb08
202 %put date2 is: &date2;
date2 is: 31Dec08
203
204 %put ------------------***;
------------------***
205 %let dateval = %sysfunc(inputn(&date1,date7.));
206 %let calc = %eval(&dateval - 365);
207 %put dateval is: &dateval;
dateval is: 17591
208 %put calc is: &calc;
calc is: 17226
209
210 %let yearago1 = %sysfunc(putn(&calc,mmddyy10.));
211 %put ******* yearago1 is: &yearago1;
******* yearago1 is: 03/01/2007
212
213 title; footnote;
214 data testmacvar;
215 d_date1 = "&date1"d;
216 d_date2 = "&date2"d;
217 yearago1 = "&date1"d - 365;
218 yearago2 = "&date2"d - 365;
219 format d_date1 d_date2 yearago1 yearago2 mmddyy10.;
220 run;
NOTE: The data set WORK.TESTMACVAR has 1 observations and 4 variables.
************************ OUTPUT *************************
Obs d_date1 d_date2 yearago1 yearago2
1 02/29/2008 12/31/2008 03/01/2007 01/01/2008
[/pre]