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

# Importing a variable

> Adding an external variable to the data set via the interview ID.

You can add a variable built **outside the platform** to your data set: a grouping, a Banner, or coding you carried out on your side. The platform links each value to the right respondent thanks to the **interview ID**.

<Note>
  The **interview ID** is the identifier of the interview **on the platform**: the 1st column of the individual data. It is not the panelist ID. It is the key that makes the reimport possible.
</Note>

## Preparing the file

<Steps>
  <Step title="Export the individual data">
    From the Results tab, export the individual data. It only contains the **Completes**. The reimport only accepts **CSV**: export directly to CSV to avoid a conversion (the Excel export is still possible, but you will have to convert it).
  </Step>

  <Step title="Keep the interview ID">
    Keep the **interview ID** column: without it, the reimport is impossible.
  </Step>

  <Step title="Build the variable">
    Add **one column per item** of your new variable. The simplest way: filter the subpopulation you want (e.g. the people familiar with a brand), fill in those respondents, then do the opposite for the opposite item. Repeat for each item.
  </Step>

  <Step title="Name the variable">
    On the 1st row, enter the **variable name**; on the 2nd row, the label of the items. You can prepare several variables at once, side by side.
  </Step>

  <Step title="Fill in both headers">
    The file has **two header rows**. The 1st starts with the fixed label `variable_name`, then gives the **variable name** for each column. The 2nd starts with the fixed label `interview_id`, then gives the **label of each item**, in the display order you want (leave it empty for a numerical or open-ended variable). To group several items into the same variable (multiple choice), repeat the **same variable name** on their columns.
  </Step>

  <Step title="Save as UTF-8 CSV">
    The reimport expects a **CSV file encoded in UTF-8**.
  </Step>
</Steps>

Example (variable "noto" with two items):

```csv theme={null}
variable_name,noto,noto
interview_id,Hydratis,Aquapop
```

The following rows contain one interview per row: its `interview_id`, then the answers to associate for each item. You can prepare **several variables at once**, side by side.

<Warning>
  Check that there is no **empty row or column** in the file: they cause errors on import.
</Warning>

<Tip>
  An example file can be downloaded directly in the variable import screen.
</Tip>

## Importing the variable

<Steps>
  <Step title="Start the import">
    In the Results, choose **Variables import** and load your CSV file.
  </Step>

  <Step title="Choose the type">
    Indicate the type of the variable: single choice, multiple choice, numerical or open-ended.
  </Step>

  <Step title="Set the label">
    Enter the label that will be displayed in the results. The variable then appears among your questions, like a **real question**: on a multiple choice variable, you can for example create subtotals.
  </Step>
</Steps>

## When the file contains errors

The file is checked during the import. As soon as it contains an error (an invalid variable or answer), the import is cancelled and **no variable is imported**.

* You receive an e-mail **"your variables import failed"**, with a **See errors** button.
* In **Export progress**, the import shows as **Failed**: click that status to open the error details, which give the file row, the variable and the reason for each error.
* The check stops after 100 errors: the file may contain more.

Fix the file, then start the import again.

## Use cases

* **Banner**: group all the socio-demographics into one **multiple choice** variable (one and the same respondent can be a man, urban and under 35). It is then used to cross the whole questionnaire in one go.
* **Coding already done**: if you coded an open-ended question yourself, import one column per code and load the file as a **multiple choice** question. There is no need to turn it back into an open-ended question: it is already coded.
* **Combined awareness**: to obtain overall awareness (a brand mentioned in **at least one** of two questions, e.g. top of mind + spontaneous), reimport an open-ended question that groups their verbatims, with the **multiple choice** type. If both questions were coded with the same code frame, the platform finds the matches without recoding. It is a **combination**, not an addition. See [Open-ended question results](/en/analyse-des-resultats/questions-ouvertes).

<Warning>
  A variable created in the Results is **tied to the survey**: it disappears if you duplicate the survey. To reuse it from one survey to another, create it beforehand in the **template**.
</Warning>

## Renaming or deleting an imported variable

An imported variable is managed from the **Question settings**, in the toolbar of its results. Questionnaire questions do not have this delete button: only variables created in the Results can be deleted here.

<Steps>
  <Step title="Open the settings">
    In the Results, open the imported variable, then click the **Settings** icon in the toolbar.
  </Step>

  <Step title="Rename if needed">
    Edit the **Variable name** and confirm. The new name is used in exports and survey comparisons.
  </Step>

  <Step title="Delete the variable">
    Click **Delete variable**, then type the requested confirmation phrase. It contains the variable identifier, such as `DP3`. If the phrase does not match, the variable is kept.
  </Step>
</Steps>

<Warning>
  Deletion **cannot be undone**. It removes the variable, its subtotals and the report charts built on it. It runs in the background: the variable may stay visible for a few moments.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.