Global macro variables work throughout a session. If you declare it once, you don't need to keep redeclaring it.
It helps to have it at the top of the program because it allows you to manually test things, but it's not necessary.
%let dd = %sysfunc(day(%sysfunc(today())), z2.);
%put DD = ⅆ
@Reeza inserted the %put just so you can see in the log which value was derived from the initial %let, and that it works as expected. That way values are also kept in the log for future reference. Aside from showing values in the log, the %put does nothing.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.