系统宏变量
/*系统宏变量*/ /*不能在data步同一行创建宏变量*/ footnote "report on &sysdate ,&sysday , &sysdate9"; *must be double qutation mark; data sasuser.talent99; set sasuser.talent; if year(lasthired)=1999; format birthdate lasthired date.; run; proc print data=sasuser.talent99; run; footnote; *把footnote内容清零; run; %let name=november; %let number=11; title1 "Actors Hired in &name"; footnote1 "Report Number &number"; data sasuser.newhire; set sasuser.talent99; if month(lasthired)=11; format lasthired date9.; run; proc print data=sasuser.newhire; run; options symbolgen; *是否将宏变量显示在日志,默认是nosymbolgen,即不显示; /*%let axd=end; &axd.date===endtime data axd..time;=== data end.time;*/ /*宏变量加后缀时需要加一个period*/ %let number=11; /*11也是character*/ %let name=November; %let abbrev=nov; %let year=99; data &abbrev.hire; set sasuser.talent&year end=last; /*end要放在set步*/ if month(lasthired)=&number then do; Fee=rate*.10; TotFee+fee; output; end; if last then call symput('total',put(totfee,dollar6.)); /*call symput定义一个宏变量,赋值某变量值,且put一个format*/ run; /*且这个变量名唯一,不能再创建*/ title1 "Actors Hired in &name"; title2 "Agency Commission &total"; /*title中引用call创建的宏变量,位置应放在call出现位置的后面*/ footnote1 "Report Number &number"; proc print data=&abbrev.hire; run;