Can some help me with this.
I have few columns to compare and generate a new column based on the result.
Example:
Present | check |
0 | 0 |
1 | 0 |
0 | 1 |
1 | 1 |
0 | 0 |
1 | 0 |
1 | 1 |
0 | 0 |
0 | 1 |
0 | 1 |
1 | 0 |
1 | 0 |
1 | 1 |
0 | 1 |
1 | 1 |
1 | 1 |
0 | 1 |
0 | 1 |
0 | 1 |
0 | 1 |
1 | 1 |
0 | 1 |
1 | 1 |
1 | 0 |
0 | 0 |
0 | 0 |
If present==1 and check==1 :
Then result=1
Else result=0
Present | check | result |
0 | 0 | 0 |
1 | 0 | 0 |
0 | 1 | 0 |
1 | 1 | 1 |
0 | 0 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
0 | 0 | 0 |
0 | 1 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
0 | 1 | 0 |
1 | 1 | 1 |
1 | 1 | 1 |
0 | 1 | 0 |
0 | 1 | 0 |
0 | 1 | 0 |
0 | 1 | 0 |
1 | 1 | 1 |
0 | 1 | 0 |
1 | 1 | 1 |
1 | 0 | 0 |
0 | 0 | 0 |
0 | 0 | 0 |
I am trying to compare the data in “present” with data in “check” i.e. if value in present is ‘1’ and the value in check is ‘1’ then create new column “Result” and make that row as “1” .
i.e (something like this)
If present==1 and check==1 :
Then result=1
Else result=0
Any help is greatly appreciated
Thank in advance!!!!
0 Response to compare entire columns in a dta file and create a new column based on the result
Post a Comment