Hello I am new to STATA and noticed a difference in the following lines of code:
replace var = 1 if dup_counter[_n] != 0 & dup_counter[_n+1] != 0 & (var[_n+1]>var[_n] | var[_n]>var[_n+1])
replace var = 1 if dup_counter[_n] != 0 & dup_counter[_n+1] != 0 & var[_n+1]>var[_n] | var[_n]>var[_n+1]
Why do the parentheses matter? The 1st line of code only modified 40 results while the 2nd modified several hundred.
Some duplicates had missing value (.) and other had values of 1 within a group of duplicates. The goal was to change all the missing within a duplicate group to 1.
replace var = 1 if dup_counter[_n] != 0 & dup_counter[_n+1] != 0 & (var[_n+1]>var[_n] | var[_n]>var[_n+1])
replace var = 1 if dup_counter[_n] != 0 & dup_counter[_n+1] != 0 & var[_n+1]>var[_n] | var[_n]>var[_n+1]
Why do the parentheses matter? The 1st line of code only modified 40 results while the 2nd modified several hundred.
Some duplicates had missing value (.) and other had values of 1 within a group of duplicates. The goal was to change all the missing within a duplicate group to 1.
Comment