# Compilation error setting variable in macro

**URL:** <https://discourse.getdbt.com/t/compilation-error-setting-variable-in-macro/11699>\
**Category:** Help\
**Tags:** jinja, snowflake\
**Created:** [January 22, 2024, 10:05pm UTC](https://discourse.getdbt.com/t/compilation-error-setting-variable-in-macro/11699 "2024-01-22T22:05:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![erick](https://avatars.discourse-cdn.com/v4/letter/e/bbce88/32.png) [@erick](https://discourse.getdbt.com/u/erick)\
**Post date:** [January 22, 2024, 10:05pm UTC](https://discourse.getdbt.com/t/compilation-error-setting-variable-in-macro/11699/1 "2024-01-22T22:05:43Z")

</div>

## The problem I’m having

I’m trying to set up three similar macros, setting the same variable in all three. I keep getting a compilation error when trying to build or compile my models. I even get a compilation error when I try to build models that are upstream of the model where the new macros are being leveraged.

I think it might be an issue with how I’ve set up my variable but I haven’t been able to figure it out. Any help would be greatly appreciated!

## The context of why I’m trying to do this

## What I’ve already tried

I’ve tried adding double quotes around "extract(‘year’, " and ") - " and have tried taking the double curlies around 'effective\_fiscal\_year\_number in the variable itself without any luck

## Some example code or error messages

Sample macro:

```auto
{% macro is_qtd(effective_fiscal_year_number, effective_date) -%}
    {% set fiscal_year_diff = extract('year', dbt_date.today()) - {{effective_fiscal_year_number}} %}
    case
        when dateadd('year', {{fiscal_year_diff}}, {{ effective_date }}) < dbt_date.today() and
        quarter(dateadd('year', {{fiscal_year_diff}}, {{ effective_date }})) = quarter(dateadd('day', -1, dbt_date.today()))
        else 0
    end
{%- endmacro %}

```

Current error message:

```auto
Compilation Error
  expected token ':', got '}'
    line 2
      {% set fiscal_year_diff = extract('year', dbt_date.today()) - {{effective_fiscal_year_number}} %}

```
