Variable Types

From Q
(Redirected from Variable Type)
Jump to navigation Jump to search
Related Online Training modules
Variable Types
Generally it is best to access online training from within Q by selecting Help > Online Training

Each variable has a specified Variable Type which dictates how it is treated by Q.

Variable Type can be modified by changing the Variable Type drop-down for a variable in the Variables and Questions tab. Multiple variables can be changed at once.

Text

A Text variable contains numbers or characters. In general, Text Variables should only be used to contain information that cannot readily be stored numerically (e.g., peoples’ names, verbatim responses to open-ended questions). Q has assorted methods for converting Text Variables into other variable types (e.g., by changing Variable Type and Coding). A method for automatically coding multiple Text variables can be found on the page How to Automatically Code Text Variables.

Some programs refer to text variables as alphanumeric variables and string variables.

Numeric

Contains numbers. For every case (respondent) in a data file, a Numeric Variable contains a single number, or, a NaN.

Equivalent to the concepts of of metric, continuous and the SPSS meaning of scale.

Categorical

Contains numbers where each Value has been assigned a non-numeric meaning (e.g., 1 = Red, 2 = Blue, 3 = Green), typically shown as the Label in Value Attributes). Equivalent to the concept of nominal.

Ordered categorical

A Categorical variable where there is a natural ordering to the categories (e.g., 1 = Low, 2 = Medium, 3 = High).

With the exception of some statistical testing and when used in an Experiment, an Ordered Categorical Variable is treated as being equivalent to a Categorical Variable

Equivalent to the concept of ordinal.

Money

A Numeric variable where the values represent a currency. Treated the same as numeric data except that in some situations the currency symbol is displayed.

Date

A Numeric variable where the values represent a times and/or dates. It contains the number of milliseconds since 1/1/1970. It is treated the same as numeric data except that can be used to create a Date question. See How to Create a Date Variable.

Date questions operate as numeric variables in many forms of analysis (e.g., if creating JavaScript Variables). You can normally use Q.Year/Month/Day/Hour/Second() to extract bits of a date or time, and Q.YearDif/MonthDif/WeekDif/DayDif/HourDif/MinuteDif/SecondDif() to compare two of them.