sas tips

1.查询每个月初数据(月底),利用intnx()函数,比较first.(last.)

data stocks;
   set sashelp.stocks;
   by stock date notsorted;
   if first.date then output;
run;
data stocks2;
   set sashelp.stocks;
   by stock date notsorted;
   Lastdt = INTNX('month', date, 0, 'b');
   output;
run;

proc compare data=stocks compare=stocks2;run;


 2.清除临时文件,proc datasets.sas代码可能生成很多临时文件,很多情况需要清除临时文件,可以在代码中间插入下面的代码.

proc datasets lib=work  memtype=data nolist;
   delete _ ;
quit;


3.删除宏 

*删除宏continuous
proc catalog catalog=work.sasmacr; 
   delete continuous / et=macro ;
quit;


4.删除global全局宏变量

%let n=2
%symdel n


 

你可能感兴趣的:(Date,delete)