Tips – Find codes in variables
I got a tips from a user after my blog post the 11 January: :
Here is a similar situation but not really the same:
In this file I would like to flag if the code 1 is found in any of the 6 attitude variables (it’s not a “Count” I am interested of here, just if the code is visible):
Use the command: Transform – Compute and then find the function ANY
Then you just follow the instruction from the help text, and I have this example:
And this will result with a new variable called Code1 that will flag with value 1 if it find the code 1 in any of the 6 attitude variables.
So as you see code 1 found in person 1 (red circles) , it’s 2 variables that has code 1, but it doesn’t matter if you have just one variable with code 1 like the second person (blue circles) or if you have many code 1 – it will be flagged in the new variable (“Code1”).
Another goal with ANY
Another goal to use the function ANY is to find some values within ONE variable. So for example to find if there is code 1,2 or 3 in the variable “att6”.
If you use this command you will get a new variable (att6with123) that looks like this:
Another function that give exakt the same result as above is if you use the function RANGE(att6,1,3).
Thanks for watching! /Gunilla