Prompt or Macro Variables used in calculations

戏子无情 提交于 2019-12-01 20:30:45

Use %EVAL() to do calculations with integers and macro variables.

%let HYR = 2018;
%Let Yr2 = %eval(&HYr. - 1);
%Let Yr5 = %eval(&HYr. - 4);

%put HYR: &hyr;
%put YR2: &yr2.;
%put YR5: &yr5.;

EDIT: If you were trying to do other calculations that included decimals you would need to use %SYSEVALF instead.

%let HYR = 2018;
%Let Yr2 = %sysevalf(&HYr. - 0.1);
%Let Yr5 = %sysevalf(&HYr. - 0.4);

%put HYR: &hyr;
%put YR2: &yr2.;
%put YR5: &yr5.;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!