Our Macro Reference Manual provides a great deal of information and examples for programming Macros.
We highly recommend reviewing the Manual, which can be downloaded from our Support Center here:
https://www.maplesystems.com/supportcenter/manuals&guides.htm
There is also a very helpful tutorial video on building macros here, which features examples of declaring a variable and programming various statements: