I am trying to generate a new variable that gives one of two "summarizing" values for four different responses for a variable (head_pt_leftside_y1):
If the data point is 1 or 2, the new variable's value should be 0
If the data point is 2 or 3, the new variable's value should be 1
I am doing this to clean a data set where the collection tool software's form we used was set up rather confusingly. This is the code I tried to write to generate this variable, but I can't seem to make it work correctly. It is giving me an r(198) syntax error currently, but I think I have a larger problem with the code as a whole, as it was a "best guess" based on scattered answers for it I found online.
Thank you all very much in advance!
If the data point is 1 or 2, the new variable's value should be 0
If the data point is 2 or 3, the new variable's value should be 1
I am doing this to clean a data set where the collection tool software's form we used was set up rather confusingly. This is the code I tried to write to generate this variable, but I can't seem to make it work correctly. It is giving me an r(198) syntax error currently, but I think I have a larger problem with the code as a whole, as it was a "best guess" based on scattered answers for it I found online.
PHP Code:
gen realheadpert_left= 1 if head_pt_leftside_y1==2 | 3 & 0 if head_pt_leftside_y1== 0 | 1
Comment