How should variables in statistics be understood? I had a slightly basic question about variables (particularly in statistics).
We would say that “height” is a variable. In my mind, “height” does not just represent different values, like 2, 45, or 75. It represents values + units: 2 feet, 45 feet, or 75 feet.
However, when we work with variables mathematically, I believe that we think of them as solely representing values / numbers. For example, we will say statements such as:
height = 2
weight = height + 4
weight = 6
It seems slightly confusing to me to have to think about variables in 2 different ways. Am I thinking about variables correctly? Thank you all for your help in advance!

You have to be careful here, because this depends on what exactly you're doing. For example, if you consider just a single variable and you compare two groups, methods such as a two-sample t-test or Wilcoxon test are scale invariant, meaning that their outcome will not depend on the measurement unit, and will be the same if you apply a linear (t-test) or even monotonic (Wilcoxon) transformation to the data, as is a change of measurement units.
Note that in most cases changes of measurement unit are linear, but they may not necessarily be, for example fuel consumption of cars can be measured by "gallons per mile" and "miles per gallon"; and you may get different results even in a t-test (as this is only invariant to linear transformation), depending on which measurement unit you choose, but not in a Wilcoxon.
If you want to test, in a single sample, for example "true mean=5", obviously this needs to use the same measurement unit as your data.
Furthermore, there are methods in statistics that are not scale invariant. Particularly when you're working with more than one variable, multivariate methods that bring information from several variables with potentially different measurement units together may be sensitive to the measurement scales. For example Principal Component Analysis and k-means clustering will implicitly give higher weight to variables that have a larger variance. This means that if one variable is weight in kg and the other one is height, the weight/impact of the height variable for the overall result will be higher if height is in cm than if the same heights are given in m, as this will yield smaller numbers and a smaller variance. In such cases it is normally recommended to standardise the data (standardising removes the effect from linear changes of the measurement units), whereas this is not recommended in some cases if the measurement units for all variables are the same, namely if for some reason in the given situation a larger variance implies that a variable is in fact more informative than the others.
