I would like to generate a variable that contains the count of the value 3 across several columns.
Part of the dataset is shown below and for example for the first row the new variable will take the value of 4 as there are 4 3s across the 8 variables.
For the second row it will take again the value of 4 and so on.
Any suggestions would be greatly appreciated.
Thank you,
Nikos
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id byte(terms twodatabases interface grey hand duplicate nolanguagerestriction contact) 2 2 2 2 3 3 2 3 3 3 2 2 2 3 3 2 1 3 4 2 2 2 2 3 2 1 3 5 2 2 2 2 2 2 2 3 6 2 2 2 2 2 2 2 3 7 2 2 2 3 2 2 3 2 8 2 2 2 3 3 2 2 3 9 2 2 2 3 2 2 3 3 11 2 2 2 3 2 2 3 2 12 2 2 2 2 3 2 3 2 end
0 Response to Generate a variable with the count of the value 3 across several variables
Post a Comment