About computed variables
Computed variables can be generated from other variables, or can reflect the result of a geographic calculation. Magic Maps does not have an explicit expression syntax, but complicated formulas can be built up by creating a series of computed variables.
To create a computed variable from an existing variable, select one or more variables from the variable table and choose an item from the Variable menu:
- Percent Change computes the percentage increase or decrease of a variable over the specified time interval.
- Time Difference computes the absolute increase or decrease of a variable over the specified time interval.
- Time Lag computes the value in a previous year, as specified by the time interval.
- Rolling Average computes an average for each year using data in surrounding years, as specified by the chosen time interval.
- Interpolate Years infers missing data by taking an appropriately weighted average of the nearest two years that are not missing data.
- Divide will divide the selected variables by a chosen variable.
- Scale multiplies the variable by a specified power of 10.
- Sum Variables adds the selected variables together.
- Aggregate is available only for point data. It computes the sum of the selected variable across all points that lie within each feature of another layer. (For example, the "Aggregate" function could be used to compute total store sales by state.)
- Apply is available only for area data. It applies the selected variable to all points in another layer contained within each area. (For example, the "Apply" function could be used to display the name of the country that each point lies within.)
The Variable menu also contains a "Weighted By" sub-menu. The chosen variable is used to compute weighted averages of the selected variables when the variable table is set to display average values.
Other computed variables do not take another variable as input. These computed variables can be created by clicking the green plus-sign button and navigating to the "New Computed Variable" sub-menu. The available options are:
- Compute Area computes the geographic area of each feature in the currently selected layer, in square kilometers. The computation uses a spherical approximation for the Earth and is accurate within 0.6%.
- Compute Length computes the geodesic length of each feature in the currently selected layer, in kilometers. The computation uses a spherical approximation for the Earth and is accurate within 0.3%.
- Compute Distance To creates a new computed variable that contains the minimum distance (in kilometers) between features in the current layer and any feature in the target layer. If the layer contains areas rather than points, the features' centroids are used for the computation. The computation uses a spherical approximation for the Earth and is accurate within 0.3%.
- Count Points creates a new computed variable that contains the number of points in the target layer for each feature in the current layer. For a point-counting function that sums a variable of interest, use the "Aggregate" function in the Variable menu.
See also: