You have to wrap it in curly brackets . Control structures and initialization should be wrapped up in {% %}. You can evaluate an expression or variable with {{ }}.
{% macro simple_replace(foo) %}
{% set bar = foo | replace(‘prod’,‘dev’) %}
{% set query %}
Select {{ bar }}
{% endset %}
{% do run_query(query) %}
{% endmacro %}
I haven’t tasted this as I am on my phone.
I suggested to go thourgh basics of jinja