Hi,
I'm creating a new variable such that a = b/c if d = chocolates or sweets, else a = b*c.
Trying to do the first part gives me error type mismatch r(109). Where am I going wrong?
I'm creating a new variable such that a = b/c if d = chocolates or sweets, else a = b*c.
HTML Code:
gen a = 0 replace a = b/c if d == "chocolates" | d == "sweets"
Comment