Dear all,
I want to generate a variable that contains random values within a specified range (e.g., 600 to 1201) and I also need to specify the conditional if to be able to generate those values only for a particular group of observations that meet certain criteria.
I tried the following but it didn“t work. Any help would be very much appreciated.
gen double u = (1201-600)*runiform() + 1 if ctrycode==1 & income_decile==1
Best,
Barbara
I want to generate a variable that contains random values within a specified range (e.g., 600 to 1201) and I also need to specify the conditional if to be able to generate those values only for a particular group of observations that meet certain criteria.
I tried the following but it didn“t work. Any help would be very much appreciated.
gen double u = (1201-600)*runiform() + 1 if ctrycode==1 & income_decile==1
Best,
Barbara
Comment