# Variables

A variable in PDI is a piece of user-supplied information that you can use dynamically and programmatically in a variety of different scopes. A variable can be local to a single step, or be available to the entire JVM (Java Virtual Machine) that PDI is running in.

PDI variables can be used in both [Basic concepts of PDI](/pdia-data-integration/9.3-data-integration/data-integration-perspective-in-the-pdi-client/basic-concepts-of-pdi.md) transformation steps and job entries. You define variables with the Set Variable step and Set Session Variables step in a transformation, by hand through the `kettle.properties` file, or through the Set Environment Variables dialog box in the **Edit** menu.

The Get Variable and Get Session Variables steps can explicitly retrieve a value from a variable, or you can use it in any PDI text field which has the dollar sign ![Diamond Dollar Sign](/files/4ahEY8jzDnLJCdpsMWMF) icon next to it by using a metadata string in either the Unix or Windows formats:

* `${VARIABLE}`
* `%%VARIABLE%%`

Both formats can be used and even mixed. In fact, you can create variable recursion by alternating between the Unix and Windows syntax. For example, if you wanted to resolve a variable that depends on another variable, then you could use this example: `${%%inner_var%%}`.

**Note:** If there is a name collision with a parameter or argument, variables will defer.

You can also use ASCII or hexadecimal character codes in place of variables, using the same format: `$[hex value]`. This makes it possible to escape the variable syntax in instances where you need to put variable-like text into a variable. For instance if you wanted to use `${foobar}` in your data stream, then you can escape it like this: `$[24]{foobar}`. PDI will replace `$[24]` with a `$` without resolving it as a variable.


---

# 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.pentaho.com/pdia-data-integration/9.3-data-integration/data-integration-perspective-in-the-pdi-client/advanced-topics-pdi-perspective/pdi-run-modifiers/variables.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.
