I would like to create a variable (total household assets) based on the values of total h/h assets provided by both partners in a household. In theory these values should be equal. However, if they differed, I thought I'd take the larger of the two by using max():
Code:
gen byte totasset = max(hwassei1, hwassei2)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(hwassei1 hwassei2) 284289 284289 55030 55030 252088 252088 427500 427500 2735000 2735000 474850 474850 863800 863800 1233019 1233019 1265062 1265062 200506 200506 827300 827300 1133209 1133209 1170430 1170430 669000 669000 873830 873830 374095 374095 867100 867100 170083 170083 88500 88500 98750 98750 408893 408893 end
0 Response to Create a new variable based on two other variables
Post a Comment