A statistical variable is each of the characteristics or qualities that the individual of a population possess and can be any number, characteristic or quantity which can be counted.

A variable is a data item, because the value varies between data units in a population and can change in value over time.

Example:
Age, business income, expenses, height, eye color, vehicle type. For instance, income is a variable that varies between data units in a population as well as income can go up or down.

There are two types of variables in statistics as follows:
  1. Qualitative Variable
  2. Quantitative Variable
Qualitative variable: Qualitative variable also known as categorical variable is an attribute, where the characteristic being studied is non numeric. Variables will have no natural sense of ordering and are measured on a nominal scale. They can be coded to be numeric, but their numbers are meaningless. Items can be different, however the difference is not a measure.

For example, honesty, hair color, religion, profession, gender etc.,
Gender can be male or female: Male = 1, Female =2.

Quantitative variable: Quantitative variable is expressed in numerical form and arithmetic operations (add, subtract, multiply and divide) can be easily performed. Age, balance in your checking account, number of children in a family are the examples of quantitative variable. Quantitative variable can either be discrete or continuous.

Discrete variable:
Discrete variable does not admit intermediate values between two specific numbers and is a whole integer value. It will have a finite number of values.
Example: Number of children in a family, number of cars in a car park.

Contin
uous variable: Continuous variable can assume any values within a specific range and can take values between two numbers.
Example: Height of 3 friends: 1.82, 1.75, 1.84.

Given below are the variable used in statistics.
Scale Properties
Examples
Qualitative / Quantitative Measure of central tendency
Nominal

Operations: =, $\neq$
There will be a difference however order will not be changed.
Santro = 1
Hyundai = 2
Volkswagen=3
Audi = 4
BMW = 5
Other = 6
Qualitative Mode
Ordinal

Operations: =, $\neq$, <, >
There will be a difference and direction of the difference will be indicated (less than or more than)
Food taste

Agree = 1
Strongly agree = 2
Disagree = 3
Strongly disagree = 4
Don't know = 5
Qualitative Median
Interval

Operations: =, $\neq$, <, >, +, -
There will be a difference and the directionality with the amount of difference in equal intervals will be indicated.
Years Quantitative Arithmetic Mean
Ratio

Operations: =, $\neq$, <, >, +, -, $\times$, /
Same as interval scale with an addition of absolute zero indicated. Income Quantitative Geometric Mean

A random variable is a function that associates unique numerical value with every outcome of an experiment and the value is subject to variation due to chance. A random variable will not have a single fixed value. Rather, it can take a set of different possible values with an associated probability and varies from trial to trial as the experiment is repeated.
A random variable can either be discrete or continuous.
Examples:
  1. A coin is tossed 5 times and the random variable X is the number of heads taken into consideration. X can take any values 0, 1,...., 5 and is a discrete random variable.
  2. The computer time (in seconds) required to process a certain program. Random variable X is the time required to process a program. X can take any value and is a continuous random variable.
In an experiment, a variable can be divided into three types: Independent(explanatory) variable, Dependent(response) variable and other variable.
Explanatory variable is the fancy word for independent variable. A variable which explains or influence changes in the response variable is known as explanatory variable and is often known as the independent variable or the predictor variable. Independent variable can be random or non random. An independent variable is an input or cause variable and are tested to see if they are the cause. The data for explanatory variable can be either categorical or quantitative.
In an experimental study, response variable measures an outcome of a study. It represents the output or effect and is tested to see if it is the effect. Response variable is dependent on the explanatory variable and is also known as dependent variable, regressand, explained variable, outcome variable, experimental variable. It is called dependent variable, because it depends on the independent variable.
Example: Suppose you're interested to know how stress rate affects heart rate in humans. Here, dependent variable is the heart rate and the independent variable is stress.
Confounding variable is an extraneous variable in a statistical model, that correlates with both the independent variable and the dependent variable, where two or more quantities vary together in such a way, where it is impossible to separately identify their unique effects. Confounding variable is statistically related with the independent variable. Whenever an independent variable changes, the confounding variable changes along with it. Confounding variables are also known as lurking variables and are accounted for in statistical experiments, so that, they don't generate non-meaningful results. The factors will be affecting the variables in the study, but will not be included in the study or analysis.
Given below are some example problems of variables.

Solved Examples

Question 1: Calculate the mean for the following data set.
123, 115, 141, 120, 85, 75, 15, 98, 136, 150.
Solution:
$\bar x$ = $\frac{\sum_{i =1}^{n} (x)}{n}$

$\bar x$ = $\frac{(123 + 115 + 141 + 120 + 85 + 75 + 15 + 98 + 136 + 150)}{10}$

$\bar x$ = Mean = 105.8

Question 2: Calculate the range for the following data: 12, 15, 10, 89, 12, 56, 14, 78, 36, 159, 25
Solution:
ange = Highest value - Lowest value
Range =  159 - 10
Range for the given data set = 149