Tags(sensors) aggregated status with templates

Hello, i need to aggregate statuses of all presence tags:

{% for sensor in states.sensor if "tag_" in sensor.name -%}
{%- if sensor.state == "room1" -%}
on
{%- else -%}
off
{%- endif -%};
{%- endfor -%}

I got result: on;on;off;
I need “or” condition to get aggregated result -> e.g. if one of it is on i must get result ‘on’, if all are off - i must get ‘off’
How i can aggregate it?

As specified on this page about variables this I can’t achieve this functionality via variables =(((
http://jinja.pocoo.org/docs/dev/templates/#assignments

Maybe you can suggest me how i can do it without creating second sensor, based on this template result?

P.S. I need to get somthing like this, but this code will not work (always got off state):

{% set ison = "off" %}
{% for sensor in states.sensor if "tag_" in sensor.name -%}
{%- if sensor.state == "room1" -%}
{% set ison = "on" %}
{%- endif -%}
{%- endfor -%}
{{ison}}