hi, in my dataset, i have incm1, incm2, incm3 and incm4 for each customer. some have only 1 income, some have 2 or more. i want to create a new variable with the max value of the 4 incomes and at the same time, i need to create a flag indicating which income is the max. for example, the max income of a record is the incm1, the new income value is easy, it's just new_income=max(incm1,incm2,incm3,incm4). i know using if statement and matching the new income value and the 4 income values can show me the source of the income. if new_income=incm1 then flag='incm1'; else if new_income=incm2 then flag='incm2'; etc.. but are there any other ways to create the new income flag which shows 'incm1' for this record? thanks
... View more