# Defining exit rules for a cohort in Atlas

You can also set rules on how patients exit your cohort. This may be useful, to define the right censoring events in a cohort used in a survival analysis study.

For instance, you can choose to exit the cohort when the patients start a treatment of a particular medication. Exit rules can be set by diagnosis and after a fixed duration relative to the initial event. In addition, you can also set how many times an event has happened before patients are excluded from the cohort. By default, patients will remain in the cohort until the end of continuous observation.

**Note:** First, check that Atlas is [reading from the vocabulary matching to the data freeze](/working-in-the-sandbox/which-tools-are-available/atlas/detailed-guide/how-to-define-a-cohort-in-atlas/selecting-configuration-in-atlas.md) of your choice.

From "Event Persistence" in the "Cohort Exit" box we can select event persistence until: "end of continuous observation", "fixed duration relative to initial event", or "end of a continuous drug exposure". With the last two options, you can select the number of days after the initial event or drug exposure to get an equal observation period for all patients in the cohort.

![](/files/wjxkWr4OlfBxv7f5obpJ)

![](/files/OjQlcLDUkWHQ1V1UceWZ)

![](/files/BEkTrDvEFAQ1jzl7P31z)

You can also add a Censoring Event from the dropdown menu under `+Add Censoring Event`.

![](/files/TXnCCaCb7tAMRp2ijjvk)

For example, you can select exclusion criteria by death selecting "Add Death" from the dropdown menu.

![](/files/DB6BOrYkjuJPXNYw1CxC)

By default exclusion criteria by death is "Any Death".

![](/files/YaUvMfZwW8vAXnlNpMdc)

To select death by a specific concept set (limiting to death say by a particular diagnostic cause), click the small arrow by the “a death occurrence from” -box, select Import Concept Set, and from the popup window find and select your [previously defined concept set](/working-in-the-sandbox/which-tools-are-available/atlas/detailed-guide/how-to-define-a-cohort-in-atlas.md#defining-a-concept-set-of-medical-codes). Pay attention to setting the concept set the right way according to whether the medical codes in the concept set are [standard or non-standard medical codes](/working-in-the-sandbox/which-tools-are-available/atlas/detailed-guide/code-sets-in-atlas.md).

![](/files/i6YwVD8LwCEpBckU38lL)

Other options with `+Add attribute…` are filtering e.g., by age of death, gender, date, or type of death.

![](/files/auarHYo3BY1w5uW1n3gD)

Exploring your new cohort with tools designed for the purpose is highly recommended before moving to downstream analysis like GWAS.

For further instructions see [General workflows for the most common analyses](/working-in-the-sandbox/general-workflows-for-the-most-common-analyses.md), [Cohort Characterizations in Atlas](/working-in-the-sandbox/which-tools-are-available/atlas/detailed-guide/cohort-characterizations-in-atlas.md), [Cohort Operations tool](/working-in-the-sandbox/which-tools-are-available/cohort-operations-tool-co.md), [Trajectory Visualization tool](/working-in-the-sandbox/which-tools-are-available/trajectory-visualization-tool-tvt.md), and [Custom GWAS tool](broken://pages/-MhYMPpmLjq4WtP_ceMi).

Custom GWAS can also be launched using the [Cohort Operations tool](/working-in-the-sandbox/which-tools-are-available/cohort-operations-tool-co.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finngen.fi/working-in-the-sandbox/which-tools-are-available/atlas/detailed-guide/how-to-define-a-cohort-in-atlas/cohort-definitions/defining-exit-rules-for-a-cohort-in-atlas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
