---
title: "Generating exact proportions of categorical values"
slug: "generating-exact-proportions-of-categorical-values"
updated: 2023-12-03T15:25:42Z
published: 2023-12-03T15:25:42Z
canonical: "userguide.dataclassroom.com/generating-exact-proportions-of-categorical-values"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://userguide.dataclassroom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generating exact proportions of categorical values

By default, the simulator generates random samples. This means that if you have a categorical variable with a given set of proportions for its values, then you will get samples distributed with these proportions **on average**. But the exact numbers are not guaranteed.

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1701616351544.png)

So if you generate 40 samples, you might get 18 males and 22 females one time, then 21 males and 19 females the next.

If you want generate a set of samples **with values matching the given proportions** **exactly**, for example exactly 20 males and 20 females, you need to click the **Settings gear icon** for the variable in the simulation view:

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1701616603006.png)

This then lets you check the **exact proportions** setting.

![](https://cdn.document360.io/62f8f41e-e041-42c4-b9bc-8ae1eb45d064/Images/Documentation/image-1701616550871.png)

Now the values will always come out 50:50 - if you generate an even number of samples, of course.

It also works for more complex proportions - if you had proportions (say) of 50%, 30% and 20%, then when you generate 10 samples, there will be 5, 3 and 2 samples with each value respectively.

It also works when generating sample sets in chunks - if you generate the 10 samples dataset (as above) as two runs of 5 samples (with **new run** turned off), then the exact proportions rule will still be obeyed.

This only works for variables that don't depend on othersIf your simulation model is complex and there are [connections](/v1/docs/connecting-variables-in-simulation-models) that let one variable affect another, then the affected variables can't be set to exact mode (as this would prevent obeying the dependency).
