By default, a new variable will be added to the top of your Data Sets tree on the left. Note, if you first select a variable in your Data Sets tree, the R variable will be added directly after that. Additionally, if you have multiple data sets in your document, you should first select the appropriate Data Sets tree you wish to add the variable to.
4. Update Name and Label as appropriate.
5. OPTIONAL: If you wish to output a categorical variable, change Structure to Nominal.
You can then update the labels by selecting DATA VALUES > Labels:
6. OPTIONAL: If the result is binary (0 or 1) and you wish to use this variable as a filter, tick Usable as a filter.
7. OPTIONAL: If the result is numeric and you wish to use this variable as a weight, tick Usable as a weight.
8. OPTIONAL: Tick Access all data rows if you wish to work with arrays. The result must also be an array.
9. OPTIONAL: Tick Accelerate (skip logic checks) to run your variable faster, particularly when your code is simple. In this case, you must first ensure you initialize all local variables before use. For example, write
var sum = 0; instead of