Dear Honourable members of the forum,
Probably my question is too easy for you, but I got stuck for the following task.
My data configguration is like that
I would like to create a new variable that count of a specific value "=1" observed in the different variables from var 1 to var 3 for each subject. For example here, the subject with id 20053, have a score=2 for the new var because the number 1 was observed 2 times within the three studied variables (var1 to var 3).
Thank you for your help.
Probably my question is too easy for you, but I got stuck for the following task.
My data configguration is like that
Year | id | Var1 | var 2 | var3 | New var |
2005 | 20051 | 1 | 0 | 0 | 1 |
2005 | 20052 | 0 | 0 | 0 | 0 |
2005 | 20053 | 0 | 1 | 1 | 2 |
2005 | 20054 | 1 | 1 | 1 | |
2005 | 20055 | 1 | 1 | 1 | |
2005 | 20056 | 1 | 1 | 1 | |
2005 | 20057 | 0 | 1 | 1 | |
2005 | 20058 | 0 | 0 | 0 | |
2005 | 20059 | 1 | 0 | 1 | |
Thank you for your help.
Comment