Open the Macro Editor by going to Macro / New. You can now either start typing your macro into the editor or copy and paste a macro from the Macros Forum. Click on Run to try running it and on Save or Save As to save the macro on your computer. You can specify the path where you want to save your macros in your Preferences: go to Project / Preferences (shortcut Ctrl/Cmd+,) and change your Macro Path to a directory of your choice.
You can specify your own shortcut to run a macro (rather than having to open it in the Macro Editor and click Run every time!). Go to Macro / Define Macro Shortcuts... (or type DU). The keyboard shortcuts Q0-Q9, W0-W9 and Y0-Y9 are reserved for user macros. Simply select the shortcut you would like to use and select your macro using the Gear Icon, click Save and your new shortcut should work.