Creating a new variable with if and or statement

Re: Creating a new variable with if and or statement

by Michael Peters -
Number of replies: 0

the syntax for or is |  

it can be found below the delete key on macs.  I am not sure where it is on a PC keyboard but it is a straight line going down.

In addition, make sure you use the double = sign or == 

 

such as gen new var=1 if oldvar==1 | otheroldvar ==2

 

MCP