| 
 | 
楼主
 
 
 楼主 |
发表于 2013-9-19 06:20:08
|
只看该作者
 
 
 
anyone can help for a SAS macro code
%macro ad(to_dt=); 
/* %let from_dt1=%sysfunc(intnx(year,"&to_dt."d,-3,sameday));*/ 
 data a; 
  from_dt1=intnx('year',"&to_dt."d,-3,'sameday');  
  format from_dt1 date9.;  
  call symput('from_dt2',from_dt1); 
 run; 
%put  from_dt2=&from_dt2.; 
%mend; 
%ad(to_dt=31aug2013) 
 
the code above just want to create a new macro variable'from_dt2' which value is the 3 years prior of 'to_dt', but failed, either just give me the number (i.e. 13850) not 31aug2010 format, or it did not work at all. 
 I want to get from_dt=31aug2010 if to_dt=31aug2013, note: not the number, have to be the date9. format. 
 
thx!!! |   
 
 
 
 |