AFAIK, variables can be defined in a YAML external file or inside the Markdown file in a header.
Then they can be used in the document. I have found examples with two different sytaxes:
Pandoc variables can only be used in pandoc templates, not the document itself. For that you should check out a preprocessor like gpp or similar.