Skip to content

Instantly share code, notes, and snippets.

@statgeek
Last active April 27, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statgeek/386c48f7ce670b4212536d5f9ae6a2ed to your computer and use it in GitHub Desktop.
Save statgeek/386c48f7ce670b4212536d5f9ae6a2ed to your computer and use it in GitHub Desktop.
SAS - macro variables and calculations
/*This is an example of doing calculations with a macro variable.
In this case, all integers allow us to use %EVAL(). Otherwise you
would need to use %SYSEVALF()*/
%let HYR = 2018;
%Let Yr2 = %eval(&HYr. - 1);
%Let Yr5 = %eval(&HYr. - 4);
%put HYR: &hyr;
%put YR2: &yr2.;
%put YR5: &yr5.;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment